executed if, and only if, a certain condition holds. var name = 'Pablo'; if (name === 'Pablo') { console.log('Hello, Pablo!'); } else { console.log('Wait, you are not Pablo!'); }
Developer Tools. Open the console. var name = 'John'; if (name === 'John') { console.log('Hello, John!'); } else { console.log('Wait, you are not John!'); }
conditions are met So instead of doing this: console.log(0); console.log(2); console.log(4); console.log(6); console.log(8); console.log(10); console.log(12);
represents an 8×8 grid, using newline characters to separate lines. At each position there's an # character. If you append "\n" to a string, it will jump the line. You're only allowed to concatenate a single character at once. ######## ######## ######## ######## ######## ######## ######## ########
print all the numbers from 1 to 100, with two exceptions. For numbers divisible by 3, print "Fizz" instead of the number, and for numbers divisible by 5 (and not 3), print "Buzz" instead. // the module operator returns the remainder of a division 3 % 3 -> 0