Coding for All
Lesson 7: Booleans
Booleans Create a true/false value.
1const isSunny = true;
2console.log(isSunny);
Terminal
$ node main.js
true
Every line, explained
const isSunny = true;
A boolean is a value that can only be true or false (both lowercase in JavaScript). JavaScript names use camelCase: first word lowercase, every new word starting with a capital, like isSunny or highScore.
console.log(isSunny);
console.log(...) prints whatever is inside the round brackets to the terminal, then moves to a new line. console is the terminal itself, log is the tool that writes to it, joined with a dot. Printing a boolean shows the word true or false.