
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Define Integer Constants in JavaScript
ECMAScript allows usage of const to define constants in JavaScript. To define integer constants in JavaScript, use the const,
const MY_VAL = 5; // This will throw an error MY_VAL = 10;
As shown above, MY_VAL is a constant and value 5 is assigned. On assigning, another value to a constant variable shows an error.
Using const will not allow you to reassign any value to MY_VAL again. If you will assign a new value to a constant, then it would lead to an error.
Advertisements