-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_ps.js
More file actions
38 lines (34 loc) · 779 Bytes
/
array_ps.js
File metadata and controls
38 lines (34 loc) · 779 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
32
33
34
35
36
37
38
// Chapter 5 Practice Set
// Practice Problem 1
// let arr = [1, 2, 3, 4, 5, 6, 7, 83]
// let a = prompt("Enter a number")
// a = Number.parseInt(a)
// arr.push(a)
// console.log(arr)
// Practice Problem 2
// let arr = [1, 2, 3, 4, 5, 6, 7, 83]
// let a;
// do {
// a = prompt("Enter a number")
// a = Number.parseInt(a)
// arr.push(a)
// } while (a != 0);
// console.log(arr)
// Practice Problem 3
// let arr = [1, 2, 30, 4, 50, 6, 7, 83, 670]
// let n = arr.filter((x)=>{
// return x%10 == 0
// })
// console.log(n)
// Practice Problem 4
// let arr = [1, 2, 30, 4, 50, 6, 7, 83, 670]
// let n = arr.map((x)=>{
// return x*x
// })
// console.log(n)
// Practice Problem 5
let arr = [1, 2, 3, 4, 5]
let n = arr.reduce((x1, x2) => {
return x1 * x2
})
console.log(n)