I have noticed while going through the Javascript/First_Steps/Variables tutorial, that I receive a syntax error message when using the suggested “let” declaration to create the object named “dog”.
When I copy the code listed here: // begin quoted bit
let dog = { name : ‘Spot’, breed : ‘Dalmatian’ };
dog.name //end quote
This throws an error in my browsers developer tools: //begin error
Uncaught SyntaxError: redeclaration of var dog
debugger eval code:1
//end quote
However, when I use the term “var” instead, I don’t get the error message. (the console logs the name “Spot” with no problem)
What could be causing this error? Yes, this is a beginner question I am certain.
The tutorial suggests that using “let” is preferable to “var” so I would like to cooperate with this instruction, but not so much when “let” causes the console.log to stop progress.
here is the tutorial page I am referring to:
Any input is appreciated.
MJ