Javascript const Keyword

JS Code Snippets const Keyword
Share:

About

In this code snippet, we’ll learn about the const keyword in Javascript.

The const keyword does almost exactly the same thing to a variable as the let keyword. You can read more about let in this post. The difference is it also makes the variable a constant meaning it can only have its value assigned once.

Let’s see the example below.

Code:

const number = 5;

//number = 5; //This won't work with const variables.

Resulting output:

Share:

Leave a Reply

Your email address will not be published. Required fields are marked *

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.

Advertisment ad adsense adlogger