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 herevar num = 1; //var can be function or global scoped
const num = 2; //const can only be block scoped
let num = 3; //let can only be block scoped// 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;
Also in JavaScript:
- run a code after delay js
- oncheck checkbox javascript
- component unmount useeffect
- how to create simple node project
- how to remove https link from javascript
- angularjs find and update object in array
- how to lose overflow in js without hidden
- sum all odd fibonacci numbers
- javascript math objects wr3
- remove node_modules folder mac
- javascript uppercase string
- mongodb check for array not empty query
- remove duplicate objects from array javascript
- syntax to call item from array
- how to control where the text cursor on div
- react routing
- javascript switch statement multiple cases
- react router dom props.history is undefined
- <!DOCTYPE html> <!--[if IE 9]> <html lang="" class="js ie9 ... www.tork.cz › product-list www.tork.cz › product-list Cached addEventListener(e,a,!1)})}l(c)}},{}],3:[function(e,n,t){function r(e,n){if(!i)return!1 ... typeof window.performance
- javascript join 2 variables into string
- scrollspyNav react
- what is local storage and session storage in javascript
- script js
- jquery check if value is in array