Try running this code in the practice editor:
1 + 2 3 + 5 - 1 // 55 / 11
The result is
7. Notice how this code is almost identical to the code in a previous lesson, but with one key difference.
55 / 11 expression, the last expression it ran was
3 + 5 - 1. That's why
7 came back as our result.
We can also comment out multiple lines like this:
console.log(1); /* console.log(2); console.log(3); */ console.log(4);
*/ is a comment.
The above code will only log
4 because the rest of the code is just a comment.
We can use this kind of comment in the middle of a line as well:
console.log(1, 2, /* 3, */ 4);
The above code won't log
3 because it has been commented out.