Skip to content

Commit 1703d19

Browse files
readme updated
1 parent ff6ea5a commit 1703d19

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
# JS-array
2+
#### arrays are used to store multiple values in a single variable
3+
4+
> declare an array
5+
6+
```js
7+
const arr = []
8+
//arr is a variable where an empty array been declared
9+
arr[0] = 1;
10+
//declared 1 as a value of index 0
11+
arr[1] = 2;
12+
arr[2] = 3;
13+
arr[3] = 5;
14+
console.log(arr.length) //arr.length gives the length of arr
15+
//output: 4
16+
console.log(arr)
17+
//output:: [1,2,3,5]
18+
arr[10] = 11;
19+
console.log(arr)
20+
//output: [ 1, 2, 3, 5, <6 empty items>, 11 ]
21+
```

0 commit comments

Comments
 (0)