Syntax error: unexpected token | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
8th Mar 2021, 7:02 AM
Amrita
Amrita - avatar
3 Answers
+ 3
Xavier in a keyword using in js , that's why you are getting an error.
8th Mar 2021, 7:57 AM
Abhay
Abhay - avatar
+ 2
let countries = [ "India", "Japan", "USA", "United Kingdom", "Singapore" ]; countries = {in: "India", uk: "United Kingdom"}; console.log(countries.in); Try this
8th Mar 2021, 7:15 AM
Khan ⭐
Khan ⭐ - avatar
- 1
Xavier you should do the javascript course first https://www.sololearn.com/Course/JavaScript/?ref=app You will see that your code has multiple syntax errors. - After let has to be a new identifier (name for variable) - "in" and "uk" are undefined - if in is only a value in a dictionary you can only access it via the dictionary Maybe more, you should really just learn the correct syntax first
8th Mar 2021, 10:17 AM
Benjamin Jürgens
Benjamin Jürgens - avatar