-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path1-variables.js
More file actions
executable file
·39 lines (29 loc) · 877 Bytes
/
1-variables.js
File metadata and controls
executable file
·39 lines (29 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*'var' keyword - variable can be called before it's declaration in the up to down flow. The value will be undefined.
variable can be redeclared.
*/
console.log(amount);//produces undefined but program runs
var amount = 2;
var amount = 6; //ok
/*
"strict mode";
'let' keyword is used to declare a variable. If you try to use this variable before it's declaration, reference error is produce.
This is defined since ES5
*/
console.log(value);//Error
let value = 20;
/*
const variable is a let which variable cannot be modified
*/
const RATE = 4.5;
RATE = 5; //error
/*
EXISTING GLOABAL STANDARD VARIABLES
console
alert
document
window
process
exports
module.
if you use these as variable names, you overwride the standard variables and calling the standard variables will not work. Eg console.log(something)will fail if you define a new variable with name console.
*/