let, cont, Var Flashcards
1
Q
What are the three ways of declaring variables in JavaScript?
A
let, const, Var
2
Q
Explain let
A
let is used to declare variables that can change during the execution of a program.
3
Q
Explain const
A
const is used to create immutable variables.
4
Q
Explain Var
A
var is the old way of declaring variables prior to ES6.
5
Q
Can empty const variables be declared.
A
No, empty const variables can not be declared. This is because const variables are immutable and their values cannot be reassigned.
6
Q
Why is it good practice to have as little variable mutations as possible?
A
This is because changing variables introduces a potential to create bugs.