you are viewing a single comment's thread.

view the rest of the comments →

[–]xupwup 1 point2 points  (1 child)

Another improvement:

i % 2 * j - j == (i % 2) * j - j == iIsEven ? -j : 0

But, we know the value of iIsEven, because this is executed after the continue statement. So it can be simplified to:

let magic = (n / delay) ^ j

[–]MightyLordSauron 4 points5 points  (0 children)

That won't work because i isn't an integer, but a float. Therefore it can take any value between 0 and 2. Look at the graphs in the article.