Skip to content

Commit cf80f87

Browse files
object js
1 parent 6c53301 commit cf80f87

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

yourPlayground.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
console.log('hello world')
21

32
// Math Methods
43
//Floor ()- Rounds down
@@ -21,4 +20,32 @@ console.log(groceries.indexOf('pear'))
2120
//start from 0 INCLUSIVE and up to 3 [0,3]
2221
console.log(groceries.slice(0, 3))
2322
// console.log(groceries.splice(3, 6))
24-
console.log(groceries.splice(1, 3))
23+
console.log(groceries.splice(1, 3))
24+
25+
// Objects
26+
27+
const personal = {
28+
name: 'Lampard',
29+
shirt: "black"
30+
}
31+
32+
console.log(personal.name)
33+
34+
35+
36+
const introducerMe = (name, shirt) => {
37+
const person = {
38+
name: name,
39+
shirt: shirt,
40+
assets: 5000000,
41+
liabilty : 100000,
42+
netWorth : function (){
43+
return this.assets - this.liabilty
44+
}
45+
}
46+
const intro = `Hi, my name is ${person.name} and the color of my shirt is ${person.shirt} and my net worth is $ ${person.netWorth()} USD`
47+
48+
return intro
49+
}
50+
51+
console.log(introducerMe('Oyindamola', 'flowery'))

0 commit comments

Comments
 (0)