I'm using let keyword in for loop as following
for(let methd1 in servUrl){
let methd=methd1;
for(let pth1 in servUrl[methd]) {
let pth=pth1;
app[methd](pth, servUrl[methd][pth]);
}
}
which gives me following error
for(let methd1 in servUrl){
^^^^^^
SyntaxError: Unexpected identifier
To solve the "Uncaught SyntaxError: Unexpected identifier" error, make sure you don't have any misspelled keywords, e.g. Let or Function instead of let and function , and correct any typos related to a missing or an extra comma, colon, parenthesis, quote or bracket.
"Unexpected identifier" means that you have a variable you're trying to reference that hasn't been declared. Make sure you pass all the variables you're trying to use into your template. All reactions.
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided. This might be a simple typo.
Can you please make sure, if you are using the supported version of node.
To know the node version you may run the following command:
$ node --version
v4.2.1
Node older versions do not support the let
syntax or EcmaScript6
all features.
I also had experienced the similar issue and upgrading my node to latest solved my issue.
To upgrade node you can run the followings:
$ sudo npm cache clean -f
$ sudo npm install -g n
$ sudo n stable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With