DEV Community

Discussion on: Built-in-like Range in JavaScript

 
jonrandy profile image
Jon Randy 🎖️

I already did a POC in about 5 lines of code - works perfectly

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️

Still trying to think of a way to make the second syntax work without unsafe monkey patching. I'm not sure it's possible. My POC uses the a[to](b) syntax. Basically, to is a method on the number prototype... nothing particularly fancy going on

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️

I think there is a way to do the 2nd syntax... I'll get back to you

Thread Thread
 
jonrandy profile image
Jon Randy 🎖️ • Edited

It works 👍 And it's safe

Thread Thread
 
didof profile image
Francesco Di Donato

I'm glad to read it. If you like to share I'd love to see it!