Skip to main content
deleted 41 characters in body
Source Link
Ankit Agarwal
  • 30.8k
  • 5
  • 41
  • 63

Use while with i+=3; inside the while loop:

function justThreesUpTo(num) { var array = []; var i = 0; while(i<num){ if(i % 3 === 0){ array.push(i);   i+=3; } } return array; } console.log(justThreesUpTo(20));

Use while with i+=3; inside the while loop:

function justThreesUpTo(num) { var array = []; var i = 0; while(i<num){ if(i % 3 === 0){ array.push(i);   i+=3; } } return array; } console.log(justThreesUpTo(20));

Use while with i+=3; inside the while loop:

function justThreesUpTo(num) { var array = []; var i = 0; while(i<num){ array.push(i); i+=3; } return array; } console.log(justThreesUpTo(20));

Source Link
Ankit Agarwal
  • 30.8k
  • 5
  • 41
  • 63

Use while with i+=3; inside the while loop:

function justThreesUpTo(num) { var array = []; var i = 0; while(i<num){ if(i % 3 === 0){ array.push(i); i+=3; } } return array; } console.log(justThreesUpTo(20));