Arrays
Store several values in one variable.
1const fruits = ["apple", "banana", "cherry"];
2console.log(fruits);
$ node main.js
[ 'apple', 'banana', 'cherry' ]
Every line, explained
const fruits = ["apple", "banana", "cherry"];- An array stores several values in one variable. The values go between square brackets, separated by commas.
console.log(fruits);- 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. Node shows the whole array between square brackets. (It displays the strings with single quotes; that is just its style.)