-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathobjects.js
More file actions
46 lines (33 loc) · 669 Bytes
/
objects.js
File metadata and controls
46 lines (33 loc) · 669 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
40
41
42
43
44
45
46
//object literal
var car={
model:"BMW",
yearOfManf:2000,
color:'yellow',
isOn:false,
switchOn:function(){
this.isOn=true;
},
};
// data object
var Car={
model:"BMW",
yearOfManf:2000,
color:'yellow',
isOn:false
};
// instance is version of the object
// bmw , mercedes,...
var bmwCar=car;
bmwCar.model="bmW";
var car2=car;
console.log(car2.model);
car2.expiryDate='2/2/2020';
//var car2=Object.create(car);
car2.gerExpiryDate=function(){return "2-2-2012"};
console.log(car.expiryDate);
console.log(car.gerExpiryDate());
// utility objects like Math
var Car={
switchOn(){},
xyz:function(){}
};