Answers for "what is the different between var and let and const in js"

14

var let const javascript

Const vs Let vs Var

const pi = 3.14

pi = 1 
cannot do this becuase with const you cannot change the value

_____________________________________


Let --> is block level 

for(let i = 0; i < 3; i++) {
console.log(i) --> it will console here
}
console.log(i) ---> Not here


---------------------------------------

Var is for variables available to the entire function 


for(var j = 0; j < 3; j++) {
console.log(j) --> it will console here
}
console.log(j) ---> it will console here
Posted by: Guest on November-07-2019
5

what is the difference between let and const in javascript

The difference is that with const you can only only assign a value to a variable
once, but with let it allows you to reassign after it has been assigned.
Posted by: Guest on June-29-2020
2

difference in var let and const

var: 
	* hoisted(global scope)
    * function scope
let:
    * block scope
    * reassignable
    * not redeclarable
const: 
    * block scope
    * not reassignable
    * not redeclarable
Posted by: Guest on August-10-2021
0

what is the different between var and let and const in js

var tester = "hey hi";
    
    function newFunction() {
        var hello = "hello";
    }
    console.log(hello); // error: hell
o is not defined
Posted by: Guest on July-30-2021

Code answers related to "what is the different between var and let and const in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language