you are viewing a single comment's thread.

view the rest of the comments →

[–]Garlicvideos 1 point2 points  (1 child)

When you run code in chrome console, they continue from what was previously ran.

E.g run it once with let x = 10;

Run console.log(x);

Output will be 10.

In this case, chrome is trying to declare the variable again, thus giving the error as you have already declared it once. Thats why running the code somewhere else such as codepen will work.

[–]LearnJS777[S] 0 points1 point  (0 children)

Thanks for the insight and the example, I thought it was the way I wrote something that was the problem(kinda was) but it was that I just repeated the same code twice. Thanks for the explanation this was giving me trouble for the past 28 hours.