r/CodingHelp • u/[deleted] • Sep 26 '21
[Javascript] Parsing const error, help please Dream Weaver
3
Sep 26 '21
Do you have ES6 syntax enabled?
1
Sep 26 '21
I’m sorry what does that mean?
2
u/AlarmedEwe Sep 26 '21
Basically, try adding
/* eslint-env es6 */
at the top of your file (i guess)
0
Sep 26 '21
Hey, tried that and it made the initial message disappear but now other messages are appearing. I’m guessing I need to use a different app
1
u/UncontrolledManifold Senior Software Engineer Sep 26 '21
It’s more likely your code than your IDE of choice.
1
Sep 26 '21
Hey, I just switched to IDE and now that issue is gone, but I believe I have a new one. It says that this code below
let classToApply = selectedAnswer == currentQuestion.answer ? 'correct' :'incorrect'
It says '.answer ' is not valid because the property "answer" does not exist on type '{}' ts(2339)
what does that mean please??
1
u/AlarmedEwe Sep 27 '21
I guess it's bcuz ur using "correct" (not "answer") to save the answer inside the object, isn't you? (that's what I understood seeing the screenshot)
2
u/jeggelke Sep 26 '21
What have you tried to fix your error? I did a quick google search and found this.
1
Sep 26 '21
I saw that article but didn’t understand what it meant :/
2
u/jeggelke Sep 26 '21
Did you read through the thread and responses? As u/nLucis said, you likely didn't have ES6 syntax enabled. The link I posted also said to add this to the top of your file:
/* eslint-env es6 */
In your other comment, you said now you have a new error. We would need you to be more specific in order to help.
1
Sep 26 '21
Not sure what to do, the values seem correct however it won’t function. Any help or ideas?
7
u/phydax Sep 26 '21
You have an extra quotation mark on the line "What is 2 times 5""