-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethods.js
More file actions
53 lines (50 loc) · 1.37 KB
/
Copy pathmethods.js
File metadata and controls
53 lines (50 loc) · 1.37 KB
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
47
48
49
50
51
52
53
let phone = {
name: "iphone",
model: "iponeX",
memory: 256,
color: "white",
power: false,
call: function(name) {
return "Я звоню" + name
},
batteryPower: 35,
getBatteryPower: function() {
return `Ваша зарядка ${this.batteryPower}%`
},
isOn: function() {
if(this.power === true) {
return "Телефон включен"
} else {
return "Телефон выключен"
}
},
switch: function() {
this.power = !(this.power)
},
sent: [
{to: "+7919 555 23 11",
time: "03:12",
message: "Сплю!"}
],
inbox: [
{from: "+2124 312 48 24",
time: "11:25",
message: "Все еще спишь?"}
],
sentMessage: function(to, time, message){
this.inbox.push({
to:to,
time: time
})
},
clearInbox: function (){
for (let i = 0; i < this.sent.length;i++) {
delete this.sent[i];
}
},
clearSent: function(){
for (let i = 0; i < this.inbox.length;i++) {
delete this.inbox[i];
}
}
};