Error: Use of const in strict mode

0 votes

I'm working with node.js, and in one of my js files I'm using const in "strict mode". When trying to run it, I'm getting an error:

SyntaxError: Use of const in strict mode.

What is the best practice to do this?

Apr 24 in Java-Script by kartik
• 11,890 points
23 views

1 answer to this question.

0 votes

Hello,

If this is happening in nodejs, it is due to the older version of nodejs. Update node by using,

1) Clear NPM's cache:

sudo npm cache clean -f

2) Install a little helper called 'n'

sudo npm install -g n

3) Install latest stable NodeJS version

sudo n stable
answered Apr 24 by Niroj
• 23,950 points

Related Questions In Java-Script

0 votes
1 answer

Error:Callback of .animate() gets called twice jquery

Hiii @kartik, To get a single callback for ...READ MORE

answered 4 days ago in Java-Script by Niroj
• 23,950 points
16 views
+1 vote
1 answer

How to get error status code of http get NodeJS?

Hello @kartik, An error code 400 response is ...READ MORE

answered 4 days ago in Java-Script by Niroj
• 23,950 points
18 views
0 votes
1 answer

What is callback function in JavaScript?

callback is not a keyword, its just ...READ MORE

answered Jan 30 in Java-Script by Niroj
• 23,950 points
199 views
0 votes
1 answer

What are XMLHttpRequest Object in Ajax?

 As, you are up to ajax so ...READ MORE

answered Jan 31 in Java-Script by Niroj
• 23,950 points
44 views
0 votes
1 answer

Why it is necessary to refresh CSRF token per form request?

Hello, Generating a new CSRF token for each ...READ MORE

answered Mar 19 in Laravel by Niroj
• 23,950 points
199 views
0 votes
1 answer

What is meant by passing the variable by value and reference in PHP?

Hello, When the variable is passed as value ...READ MORE

answered Mar 27 in PHP by Niroj
• 23,950 points
41 views
0 votes
1 answer

Connection with MySQL server using PHP. How can we do that?

Hey @kartik, You have to provide MySQL hostname, ...READ MORE

answered Mar 27 in PHP by Niroj
• 23,950 points
44 views
0 votes
1 answer

How to retrieve or obtain data from the MySQL database using PHP?

Hello kartik,  Actually there are many functions that  ...READ MORE

answered Mar 27 in PHP by Niroj
• 23,950 points
36 views
0 votes
1 answer

How to use Redirect in the new react-router-dom of Reactjs?

Hello, To navigate to another component you can ...READ MORE

answered May 18 in Java-Script by Niroj
• 23,950 points
31 views
0 votes
1 answer

Error: Unexpected token import in nodejs

Hello, Unfortunately, Node.js doesn't support ES6's import yet. To accomplish what ...READ MORE

answered Apr 24 in Java-Script by Niroj
• 23,950 points
293 views