Re: [NWRUG] Monkey Patching JavaScript

2024-08-20 Thread Darren Jones
I’ll share what I hack together … On Tue, 20 Aug 2024 at 08:11, Darren Jones wrote: > Yeah I’ve added quite a few methods. > > You can also add properties as well which is nice. > > JavaScript is a really flexible language but missing quite a bit of stuff. > > > > On Mon, 19 Aug 2024 at 09:56, L

Re: [NWRUG] Monkey Patching JavaScript

2024-08-20 Thread Darren Jones
Yeah I’ve added quite a few methods. You can also add properties as well which is nice. JavaScript is a really flexible language but missing quite a bit of stuff. On Mon, 19 Aug 2024 at 09:56, Lee Hambley wrote: > Because Javascript is a "prototype" oriented language (although, modern > intr

Re: [NWRUG] Monkey Patching JavaScript

2024-08-19 Thread Lee Hambley
Because Javascript is a "prototype" oriented language (although, modern introduction of Class keyword, and the rise of TypeScript has obscured that somewhat) you can simply do this which was even considered idiomatic a decade ago: Array.prototype.reverse = function() { let start = 0; let end =