Why is it giving me this error Uncaught ReferenceError: Cannot access 'color' before initialization 37

Uncaught ReferenceError: Cannot access ‘color’ before initialization

37

​thats my error:

heres my code

let color = prompt(“What’s your favorite color?”)

(color) ? printToScreen(“Wow, " + color + " is my favorite color too”) : printToScreen(“didnt quite get that”);

Please help me i dont know whats wrong

You need a semicolon ending the first line, otherwise, you have to remove the parentheses around color.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.