-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalsstask.js
More file actions
79 lines (50 loc) · 1.29 KB
/
Copy pathcalsstask.js
File metadata and controls
79 lines (50 loc) · 1.29 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
68
69
70
71
72
73
74
75
76
77
78
79
//1.
const person = { name:"Tosin",
complexion:"Black",
stateOfOrigin:"Kaduna",
country:"Nigeria"};
//2.
const car = { make:"Toyota",
model:"Camry",
year:2021 };
function carfunction(car){
for (const property in car) console.log(`${property} : ${car[property]}`);
}
carfunction(car);
//3.
const laptop = { brand:"Dell" , price : 1200}
laptop["color"] = "blue";
console.log(laptop);
//4.
const phone = {brand:"Apple", price:999};
phone["price"] = 1500
console.log(phone)
//5.
const person2 = { firstName : "john",
lastName :"jonnah" }
const names = Object.values(person2);
function getNames(){
return console.log(names[0]+" "+names[1]);
}
getNames();
//6.
const person3 = { FirstName: "john" , LastName : "Doe" , age : 25 }
const values = Object.values(person3)
function getDetails(){
console.log(`First Name = ${values[0]}, Last Name : ${values[1]}`)
}
getDetails();
//7.
const book = {title:"The Great Gatsby", author:"F.Scott Fitzgerald", yearPublished : 1925 }
function getBookInfo(book){
const {title,author} = book;
console.log(title + " by " + author )
}
getBookInfo(book)
//8.
samsDetails = {name:'Sam',age:40 , profession:"Engineer"};
function getNameAndAge(samsDetails){
const {name,age} = samsDetails
console.log(name +" "+ age )
}
getNameAndAge(samsDetails);