Skip to content

Commit 73c64c9

Browse files
authored
Merge pull request #7 from dmlsthe1/dl-feature
changed conflict when reinstantiating a constant
2 parents 3ccd9a0 + ab66637 commit 73c64c9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

02-chapter-Array/readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,19 @@ const myArray = [1, 'one', {some: 'object'}, new Date()]
1919
**Creating an array**
2020

2121
```
22+
/**** create new variable ****/
2223
const grades = [1,2,3]; // this is the best way to create an array.
2324
const grades = new Array(1,2,3); // use of the constructor.
2425
const grades = new Array(3); // will initialize the array with the length of 3.
26+
const newGradesArray = [...grades, grade]; // will declare the newGradesArray variable and assign the values from the grades array and from grade.
27+
/**** create new variable ****/
28+
29+
/**** change const to let ****/
30+
let grades = [1,2,3]; // this is the best way to create an array.
31+
let grades = new Array(1,2,3); // use of the constructor.
32+
let grades = new Array(3); // will initialize the array with the length of 3.
2533
grades = [...grades, grade]; // will reinstantiate the grades variable.
34+
/**** change const to let ****/
2635
2736
// use of the concat() function.
2837
const a = [1,2,3];

0 commit comments

Comments
 (0)