-3

I am a little confused with this piece of code. I would really appreciate a step by step walk-through.

 i = 0;
 !(i % 3 && i % 5) && arr.push(i), i++
newtocode
  • 11
  • 2

1 Answers1

0

A step by step walkthrough:

i = 0; // assignment of 0 to the global variable i//
!// the opposite of the following expression, note does not apply to
//expression not in parentheses below // 
(i % 3 && i % 5) // returns
//true if i does  
// equal zero for both i % 3 and i % 5 // in javascript 0 is a falsy 
//value
&& arr.push(i) // returns true if the length property of arr is not
// 0, i++