forked from learning-zone/javascript-basics
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnamespace.html
More file actions
Latest commit
22 lines (20 loc) · 448 Bytes
/
Copy pathnamespace.html
File metadata and controls
22 lines (20 loc) · 448 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<head>
<title>Namespace in JS</title>
</head>
<script>
varMYNAMESPACE=MYNAMESPACE||{};
MYNAMESPACE.MessageClass=function(msg){
this.value=msg;
this.getMessage=function(){
returnthis.value;
};
};
varobj=newMYNAMESPACE.MessageClass('Pradeep');
console.log("Hello "+obj.getMessage());
</script>
<body>
Namespace in JavaScript
</body>
</html>