-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.js
More file actions
31 lines (23 loc) · 704 Bytes
/
array.js
File metadata and controls
31 lines (23 loc) · 704 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
// *The Array object is used to store multiple values in a single variable:
var a = [65, 65, 65, 56, 54, 45, 46, 46, 54, 654]
// console.log(a.length);
// console.log(a);
// console.log(a[3]);
// replace array
// a[2] = 500;
// console.log(a);
console.log(a.indexOf(654));
// W3 Practice
var cars = ["Saab", "Volvo", "BMW"];
console.log(cars);
// 2 Array join or 2 concat
var arr1 = ["Cecilie", "Lone"];
var arr2 = ["Emil", "Tobias", "Linus"];
var join = arr1.concat(arr2);
console.log(join);
// Join three array or concat
var car1 = ["bmw, toyota, mazda"];
var car2 = ["volvo, tata, eicher"];
var car3 = ["ferrari, tesla, range rover"];
var total = car1.concat(car2, car3);
console.log(total);