-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay7.js
More file actions
62 lines (48 loc) · 1.08 KB
/
Copy pathDay7.js
File metadata and controls
62 lines (48 loc) · 1.08 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
//Activity 1
let book={
title:"junglebook",
author:"Rubyard Kipling",
year:1998
}
console.log(book)
let a=book.title
let b=book.author
console.log(a,b)
//Activity 2
book.info=function info(){
return (`${this.title} was written by ${this.author} in ${this.year}`)
}
console.log(book.info())
book.updateyear=function updateyear(nyear) {
return this.year=nyear;
}
console.log(book.updateyear(2005))
console.log(book)
//Activity 3
let booklib={
namelib:"maxlib",
books:[
{
title:"jungle book",
author:"rubyard kipling"
},
{
title:"tekken",
author:"mrigaank sharma"
}]
}
console.log(booklib)
console.log(booklib.namelib)
console.log(booklib.books.map((books)=>books.title))
booklib.method=function method(){
return (`${this.books.map((books)=>books.title)} by ${this.books.map((books)=>books.author)}`)
}
console.log(booklib.method())
//Activity 5
for (const key in book) {
{
const element = book[key];
console.log(element)
}
}
console.log(Object.keys(book),Object.values(book))