Skip to content

Commit 6b5f32a

Browse files
refactor: variable
1 parent 07a5658 commit 6b5f32a

File tree

10 files changed

+11
-10
lines changed

10 files changed

+11
-10
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

4_variable/1_variable.js renamed to 04_variable/01_variable.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
// Why
77
// - Variables are used to keep track of data that we want to use or change in our programs. They help us store values temporarily and reuse them later in our code.
88

9-
// Note
10-
// - To create variable you can use var, let and const keyword.
11-
// - `var` keyword has been deprecated so it's not recommended to use. Only use `let` and `const`.
12-
139
// Syntax
10+
1411
// Single variable
15-
var variable = 0; // Not Recommended
16-
let variable1 = 1;
17-
const variable2 = 2;
12+
var variable = 1 // Not Recommended
13+
let variable1 = 2
14+
const variable2 = 3
1815

1916
// Multiple variable with same value
2017
// - First declare then initialize
@@ -32,3 +29,6 @@ let variable6 = 1,
3229
// - The fact that whenever we declare a variable and assign a value to it, it’s not the variable that holds the value but rather the variable just holds an address in the memory where the initialized value is stored. Further explaining, take for example:
3330
let age = 21;
3431
// - when we use age, it gets replaced with 21, but that does not mean that age contains 21, rather what it means is that the variable age contains the address of the memory location where 21 is stored.
32+
// - To create variable you can use var, let and const keyword.
33+
// - `var` keyword has been deprecated so it's not recommended to use. Only use `let` and `const`.
34+

4_variable/2_var_keyword.js renamed to 04_variable/02_var_keyword.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ var variable;
88
variable = "value";
99

1010
// Redeclare
11-
// - As you can see your are using same variable name twice. But for value it will take latest updated value.
11+
// - As you can see your are using same variable name twice.
12+
// - It will take latest updated value.
1213
var variable = "value1";
1314
var variable = "value2";
1415

File renamed without changes.

4_variable/4_const_keyword.js renamed to 04_variable/04_const_keyword.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function myFunction(parameter) {
3434

3535
// Constant Objects and Arrays
3636
// - The keyword const is a little misleading.
37-
// - It does not define a constant value. It defines a constant reference to a value. Because of this...
37+
// - It does not define a constant value. It defines a constant reference to a value.
3838

3939
// Can't:
4040
// - Reassign a constant value
File renamed without changes.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
1. `use strict`
2222

23-
4. Variable
23+
4. Variable <-
2424

2525
1. `var` Keyword
2626
2. `let` Keyword

0 commit comments

Comments
 (0)