Variable
- variables are lable that references a value.
- variables are used to store information to be reference and manipulated in a computer program.
- variables holds information/data.
- storing information.
let name = 'Manikandan';
let -> start with //(let, var, const)
name -> variable identifier
Manikandan -> information/data
; -> end of the statement
var
- var is function-scope.
- Variables defined with 'var', redeclare and reassign is possible.
let
let is block-scope
Some lines of code will written in { } these parentheses, it
is called block-scope.
block-scope Variable cannot be access outside the block.
- Variables defined with 'let', must be declare before use/assign value.
- Once declare a Variable with 'let', after re-assign is possible but redeclare is impossible.
const
- const is block-scope.
- variable define with 'const', cannot be redeclare and cannot be reassign.
Top comments (0)