This is an Awesome string of code you've written. I'm partial to Python3 behavior of range though. Made a few minor adjustments yours. Better to steal like an artist then build from scratch.
function*range(start=0,end=undefined,step=1){if(arguments.length===1){end=start,start=0}[...arguments].forEach(arg=>{if(typeofarg!=='number'){thrownewTypeError("Invalid argument")}})if(arguments.length===0){thrownewTypeError("range requires at least 1 argument, got 0")}if(start>=end)returnyieldstartyield*range(parseInt(start+step),end,step)}// Use Casesconsole.log([...range(5)])console.log([...range(2,5)])console.log([...range(2,5,2)])
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is an Awesome string of code you've written. I'm partial to Python3 behavior of range though. Made a few minor adjustments yours. Better to steal like an artist then build from scratch.