-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray-method.js
44 lines (27 loc) · 1.01 KB
/
array-method.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
let names = ['daroth','thida','kosal','dara'];
let others = ['sammy', 'gary','wolfgang','mark'];
let lost = [4, 8, 15, 16, 23, 42];
let fibonacci = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
var combine = lost.concat(fibonacci);
//console.log(combine);
//console.log(fibonacci.join('~'));
//push , pop
// console.log(lost.shift());
// console.log(lost);
// lost.unshift(1, 2, 3, 4);
// // console.log(lost);
// console.log(names);
// console.log(names.reverse());
// console.log(names.sort());
//console.log(others.indexOf('mark'));
console.log(combine);
console.log(combine.lastIndexOf(1));
//map
var filtered = combine.filter((x) => {if(x <= 15) return x;});
// console.log(filtered);
// names.forEach((name) => console.log(`Hello ${name}`));
// console.log(filtered.every((num) => num < 10));
console.log(filtered.every((num) => num < 16));
// console.log(fibonacci.some((num) => num > 50));
// console.log(fibonacci.some((num) => num > 100));
console.log('Hello world!');