Printing with console.log
console.log prints the value you give it, then starts a new line. So two calls print two lines:
console.log("one");
console.log("two");
Output:
one
two
A value that you put inside the parentheses is called an argument. console.log can take any number of arguments. You separate them with commas, and it prints them on one line with a space between each one:
console.log("Alice", 34);
Output:
Alice 34
Text needs quotes, but numbers do not. Anything that is not in quotes is worked out first, and then the result is printed:
console.log(6 * 7);
console.log("6 * 7");
console.log(95 > 90);
console.log();
console.log("end");
Output:
42
6 * 7
true
end
The first two lines have the same characters but print different things. Without quotes, 6 * 7 is a calculation, so JavaScript prints 42. Inside quotes, nothing is calculated. It is just text that looks like a calculation.
The third line is a comparison. 95 > 90 asks "is 95 greater than 90?", and the answer is true. You will learn more about true and false soon.
An empty console.log() prints a blank line. Later in the course, you will also give console.log whole lists and objects, and it prints them in a readable form. Programmers use it all the time to check what their code is doing.
In the exercise, finish two lines: one call with four arguments, and one that prints the result of a comparison.