-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP5.js
More file actions
39 lines (38 loc) · 756 Bytes
/
P5.js
File metadata and controls
39 lines (38 loc) · 756 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
39
//Q-1
// let a1 = [1,2,4,5,6,7,8]
// let a = prompt("Enter a Number")
// let a = 3;
// a = Number.parseInt(a)
// a1.push(a)
// console.log(a1);
//Q-2
// let arr = [1,2,4,5,6,7,8]
// let a = prompt("Enter a Number")
// let a2;
// do{
// a2 = 3
// a2 = Number.parseInt(a2)
// arr.push(a2)
// }while(a2 != 0);
// console.log(arr);
//Q-3
let arr = [1,4,5,6,7,8,10,13,15]
// let n = arr.filter((a)=>{
// return a%10 == 0
// })
let n = arr.filter(arr =>
arr%10 === 0);
console.log(n);
//Q-4
let a1 = [1,4,5,6,7,8,10,13,15]
// let a = arr.map((y)=>{
// return y*y
// })
let a = a1.map(a1=>a1*a1);
console.log(a);
//Q-5
let c = [1,2,3,4,5,6];
let d = c.reduce((x1,x2) =>{
return x1 * x2
})
console.log(d);