Why can I use a comma (,) instead of a plus (+)?
In ES6 can I concatenate things with “,” and “+”?
Sorry for the inconvenience.
Your code so far
function checkScope() {
"use strict";
let i = "function scope";
if (true) {
let i = "block scope";
console.log("Block scope i is: "**, i**);
}
console.log("Function scope i is: ", i);
return i;
}
console.log(checkScope());
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.
console.log() accepts a variable number of arguments and concatenate their string rapresentation together, so you can put different arguments in there and they are all logged to the console, but you are not concatenating the string with the comma - to concat the strings you need +