-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprototype.html
More file actions
40 lines (32 loc) · 819 Bytes
/
Copy pathprototype.html
File metadata and controls
40 lines (32 loc) · 819 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
<!--
* Cytonn Technologies
*
* @author: Hashim Amani <hamani@cytonn.com>
*
* Project: Javascript.
*
*-->
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function Student(name)
{
this.name = name;
}
Student.prototype.getName = function()
//Student.getName = function()
{
return this.name;
}
//this objects have inherited all the properties including the getName() function.
var s1 = new Student("Hashim");
var s2 = new Student("Amani");
document.write("Student 1 name =" + s1.getName() + "</br>");
document.write("Student 2 name =" + s2.getName() + "</br>");
</script>
</body>
</html>