-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectAccessor.html
More file actions
36 lines (30 loc) · 1.12 KB
/
Copy pathObjectAccessor.html
File metadata and controls
36 lines (30 loc) · 1.12 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
<html>
<head>
<h1>Program for object Accessors ....</h1>
</head>
<body>
<p id = "demo"></p>
<p id = "demo1" ></p>
<script>
const person = {
firstName : "karan",
LastName : " haise",
_language : " English",
salary : " ",
get language()
{
return this._language;
},
set upsalary(s)
{
this.salary = s;
}
};
document.getElementById("demo").innerHTML= person.language;
// settin the value
person.upsalary = 10000000;
document.getElementById("demo1").innerHTML= person.LastName + person.firstName +person.language +person.salary;
// here one important thing about the setter is it can have a single value ...
</script>
</body>
</html>