What is the use of let & const in JavaScript?

devquora
devquora

Posted On: Feb 22, 2018

 

In modern javascript let & const are different ways of creating variables. Earlier in javascript, we use the var keyword for creating variables. let & const keyword is introduced in version ES6 with the vision of creating two different types of variables in javascript one is immutable and other is mutable.
const: It is used to create an immutable variable. Immutable variables are variables whose value is never changed in the complete life cycle of the program.
let: let is used to create a mutable variable. Mutable variables are normal variables like var that can be changed any number of time.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    JavaScript Interview Questions

    Explain what is Javascript?

    Javascript Javascript is an object-oriented computer programming language commonly used to create interactive effects wi..