-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path13.objects.html
28 lines (23 loc) · 933 Bytes
/
13.objects.html
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
<html>
<head>
<script type="text/javascript">
var my_var = "prasad" // my_var is my object here
document.write(my_var.length) // objects have properties e.g length and methods e.g. write
// these were inbuild javascipt objects
document.write("<br />") // going on new line
// creating my own object
function person(name, age)
{
this.name = name // seems to be like python self
this.age = age
}
var my_object_1 = new person("Prasad Dalavi", 24) // similar to jave instance creation
var my_object_2 = new person("Pranit Dalavi", 19)
</script>
</head>
<body>
<script type="text/javascript"> // I am writing this javascipt for the second time.
document.write(my_object_1.name) // calling the properties/methods of object
</script>
</body>
</html>