-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.js
More file actions
39 lines (31 loc) · 808 Bytes
/
Copy pathobject.js
File metadata and controls
39 lines (31 loc) · 808 Bytes
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
// const student={
// name:"Anant Pratap Singh",
// age:12,
// roll_no:12345,
// course:"B.Tech"
// }
// // console.log(student["course"]);
// //if we wangt to change any value inside the object
// student["age"]=student["age"]+4;
// console.log(student["age"]);
// let str=`the name is ${student.name} and course is ${student.course}`; //template literals in javascript
// console.log(str);
// var obj1 = {
// x: 43,
// y: "Hello world!",
// z: function(){
// return this.x;
// }
// }
// const output=obj1.z();
// console.log(output);
//with the introduction of ES6 we can not assign the function name like the above
var obj1 = {
x: 43,
y: "Hello world!",
z(){
return this.x;
}
}
const output=obj1.z();
console.log(output);