Friday, April 11, 2014

hacker school CracklePop program

function runCracklePop() {
  for( var i = 1; i <= 100; i++ ) {
    var output = '';
    if ( i % 3 == 0)
      output += 'Crackle';
    if ( i % 5 == 0 )
      output += 'Pop';
    console.log( output ? output : i);
  }
}

runCracklePop();

No comments:

Post a Comment