@@ -19,10 +19,19 @@ const myArray = [1, 'one', {some: 'object'}, new Date()]
19
19
** Creating an array**
20
20
21
21
```
22
+ /**** create new variable ****/
22
23
const grades = [1,2,3]; // this is the best way to create an array.
23
24
const grades = new Array(1,2,3); // use of the constructor.
24
25
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.
25
33
grades = [...grades, grade]; // will reinstantiate the grades variable.
34
+ /**** change const to let ****/
26
35
27
36
// use of the concat() function.
28
37
const a = [1,2,3];
0 commit comments