-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathobject.js
More file actions
18 lines (14 loc) · 517 Bytes
/
object.js
File metadata and controls
18 lines (14 loc) · 517 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
let person = {
name : 'Kaiwalya',
age : 18,
like : 'pizza',
favouriteProgrammingLanguage: 'HTML'
}
console.log(person.favouriteProgrammingLanguage);//will show HTML
person.favouriteProgrammingLanguage = 'Java'
console.log(person.like);//Will show Java
//Ways to access the elements in the object
//----------- Both are Okay ----------------
console.log(person.age);//Will print 18
console.log(person["age"]);//Will print 18
//Even if we do const person{} we will be able to access and modify this.