Answers for "let var const"

2

var or const in javascript

// var declares a variable, meaning its value will vary. 
// const declares a constant, meaning its value will remain 
// consistant and not change. 
// If your variable changes throughout the program or website, 
// declare it using a var statement. 
// Otherwise, if its value does not change, declare it using 
// a const statement. 

const myConst='A const does not change.';

var myVar='A var does change.';

var myVar=2;
Posted by: Guest on July-09-2020
0

const let var

var greeter;
    console.log(greeter); // greeter is undefined
    greeter = "say hello"
Posted by: Guest on March-30-2021
0

const let var

var makes real ice cubes that rattle around in New York
let makes real ice cubes in Manhatten 
const is like let but the ice cubes never change because they are plastic
Posted by: Guest on April-14-2021
1

var let const javascript

// `let` vs `var` vs `const` in 'javascript'

"let" allows you to declare local variable whose scope 
      is limited to the block statement.

"var" allows you to declare a variable globally or locally 
      to an entire function.

"Const" just like let, are block-scoped.
        It's value can't be reassigned and it can't be redeclared.
Posted by: Guest on November-19-2021

Browse Popular Code Answers by Language