javascript var and let
// var has function scope.
// let has block scope.
function func(){
if(true){
var A = 1;
let B = 2;
}
A++; // 2 --> ok, inside function scope
B++; // B is not defined --> not ok, outside of block scope
return A + B; // NaN --> B is not defined
}
Also in JavaScript:
- heap sort
- mongoose reference another model
- how to make and add to an array in javascript
- express js
- mdn select event
- mysql get json value by key
- js add src to img
- typescript filter array of null
- javascript unique array of objects by property
- jquery on form submit call function
- const { message }
- tolocalestring javascript currency fixing 2 decimal places
- json_extract in non native query
- react check if browser is in dark mode
- how to add an array to another array in javascript
- javascript loop an array check if a number is even
- how to remove last element in js
- how to change background image dynamically in react
- javascript convert string to 2 decimal
- blazor sample ujsing cliam policy
- indexing string in javascript
- disable input jquery
- break in if statement js
- regex only uppercase letters js