Hi all,
I’m working on Practice Javascript Syntax Decline Everything and Accept Everything ( Practice JavaScript Syntax: Arrays, Loops, Objects, Iterators | Codecademy. I have a line of code that is giving me an unexpected token error and I don’t understand why. The full code and error will follow a brief line of code and error.
The code:
veggies.forEach(veggie) => politelyDecline(veggie);
The Error:
SyntaxError: Unexpected token
Full code:
Full Error:
/home/ccuser/workspace/intermediate-javascript-coding-challenge-using-for-each/main.js:9
veggies.forEach(veggie) => politelyDecline(veggie);
^
SyntaxError: Unexpected token .
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_nod
Any help would be greatly appreciated! I’ve been stuck here for a while. According to the MDN, my code is written with proper syntax.
Thanks,
Mel