-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntroToObjects.html
More file actions
37 lines (28 loc) · 844 Bytes
/
Copy pathIntroToObjects.html
File metadata and controls
37 lines (28 loc) · 844 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
<html>
<head>
<title>Introduction To The Objects</title>
<h1>Introduction to the Objects</h1>
</head>
<body>
<script type="text/javascript" >
function student(name,age,subject)
{
this.name = name;
this.age =age;
this.subject = subject;
this.eat = function()
{
document.writeln("students is eating")
}
}
var s1 = new student("pasindu",24,"IT");
var s2 = new student("amal",23,"history");
var s3 = new student("roy",18,"english");
document.write(s1.age)
s1.eat()
document.write(s1.subject)
document.write(s2.subject)
document.write(s3.subject)
</script>
</body>
</html>