Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
// Wow,.. fancy :|step=n=>(n&~1)>>((~n)&1)// note that they're ~'s, not -'s// Count how many times we need to iterate step until it hits 0countSteps=n=>{if(n<=0||Math.floor(n)!==n)thrownewError(`countSteps only accepts positive integers, ${n} was passed`);letcount=0;while(n=step(n))count++;returncount;}
(couple of edits to make it cleaner)
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.
JS using a bit of bitwise math
(couple of edits to make it cleaner)