Skip to content

Commit 77d3632

Browse files
authored
Create Object.js
1 parent a3cb055 commit 77d3632

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Diff for: Object.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*const jonasArray = [
2+
'Jonas',
3+
'Rejwar',
4+
'2037-1999',
5+
'teacher',
6+
['Michael','Peter','Steven']
7+
];
8+
*/
9+
10+
const jonas ={
11+
12+
firstName : 'Jonas',
13+
lastName : 'Rejwar',
14+
age :2037-1999,
15+
job : 'teacher',
16+
friends : ['Michael','peter','John']
17+
};
18+
19+
console.log(jonas);
20+
console.log(jonas['lastName']);
21+
22+
const nameKey ='Name';
23+
console.log(jonas['first' +nameKey]);
24+
console.log(jonas['last' +nameKey]);
25+
26+
const interestedIn = prompt('What in it for me ?');
27+
console.log(jonas[interestedIn]);
28+
29+
30+
if (jonas[interestedIn]){
31+
console.log(object);
32+
} else{
33+
console.log('Wrong request ! ');
34+
}
35+
36+
jonas.location = 'Portugal';
37+
jonas['twitter'] = '@rejwar';
38+
console.log(jonas);
39+
40+
console.log(`${jonas.firstName}has ${jonas.friends.length},and his bestfriend ${jonas.friends[0]} `);

0 commit comments

Comments
 (0)