-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay8.js
More file actions
67 lines (58 loc) · 1.02 KB
/
Copy pathDay8.js
File metadata and controls
67 lines (58 loc) · 1.02 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//Activty 1
let age=19;
let pname="micky"
console.log(`my name is ${pname} and my age is ${age}`)
let cot="india"
let a=`my name is ${pname} and my age is ${age}.
i belong to ${cot}`
console.log(a)
//Activity 2
let arr=[1,2,3,4,5,"mrigaank",7,8]
const [l,m]=arr;
//const l=arr[0],m=arr[arr.length-1];
console.log(l,m)
let book={
title:"jungle book",
price:120
}
const {title,price}=book;
console.log(title)
console.log(price)
//Activity 3
let g=[...arr,"mks","sharms"]
console.log(g)
function sum(...num){
return num.reduce((a,b)=>a+b,0)
}
console.log(sum(1,2,3,4,5))
//Activity 4
function prod(a,b=2){
return a*b;
}
console.log(prod(2,4))
console.log(prod(2))
//Activity 5
let s="mrigaank"
let d="sharms"
let sk=24;
let person={
s,
d,
sk,
greet(){
return `hello ${s}`
},
greet2(){
return `hello ${s} ${d}`
}
}
console.log(person)
console.log(person.greet())
console.log(person.greet2())
key1="name"
key2="age"
let p={
[key1]:"mrigaank",
[key2]:19
}
console.log(p)