Rod R3,049 Points
step 1 in demo causes error- Uncaught SyntaxError: Identifier 'myHeading' has already been declared at <anonymous>1:1
I launched the workspace for this video and the first step is causing a console error. Guil is entering > let myHeading = document.querySelector('h1'); But when I do the same I get a console error: Uncaught Syntax: Identifier 'myHeading' has already been declared at <anonymous>:1:1 Can I clear it somehow? Here is the default HTML in the workspace:
<link rel="stylesheet" href="css/style.css">
<p>Making a web page interactive</p>
<p>Things that are purple:</p>
<ul> <li>grapes</li> <li>amethyst</li> <li>lavender</li> <li>plums</li> </ul> <script src="app.js"></script>
I launched the webpage, opened the console, and typed:
let myHeading = document.querySelector('h1');
How can I get past this error to code along with Guil?
Steven Parker177,482 Points
The app.js file that your HTML loads currently contains just one line: "
var myHeading;" So it is indeed already declared.
You could either remove that line from the file, or when you enter your console code, just omit the keyword "let".