-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw8Task1.js
More file actions
44 lines (41 loc) · 1.06 KB
/
Copy pathhw8Task1.js
File metadata and controls
44 lines (41 loc) · 1.06 KB
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
const numberArr = [7, 8, 2, 30, 85, 95, 77, 94, 37, 31]
// TASK 1
numberArr.forEach((value) => {
if(value % 3 == 0){
console.log(value)
}
})
// TASK 2
const mapArray = numberArr.map((value, index, arr) => {
return value - arr.length
})
console.log(mapArray)
// TASK 3
const filterArray = numberArr.filter((value, index, numberArr) => {
return index > 0 && value > numberArr[index - 1]
})
console.log(filterArray)
// TASK 4
const findArray = numberArr.find((value, index, numberArr) => {
return index == value
})
console.log(findArray)
// TASK 5
const modifiedArray = [...numberArr]
const sortArray = modifiedArray.sort((a, b) => a - b)
console.log(modifiedArray)
// TASK 6
const reduceArray = numberArr.reduce((accumulator, value) => {
return accumulator + value
}, 0)
console.log(reduceArray)
// TASK 7
const someArray = numberArr.some((value) => value > 90)
console.log(someArray)
// TASK 8
const everyArray = numberArr.every((value, index, numberArr) => {
if (value.toString().length == 2){
return true
}
})
console.log(everyArray)