We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd50e01 commit b7dc162Copy full SHA for b7dc162
server.js
@@ -0,0 +1,6 @@
1
+var http =require('http');
2
+http.createServer(function(request,response){
3
+ response.writeHead(200,{'Content-Type':'text/plain'});
4
+ response.end('hello node.js\n');
5
+}).listen(8080);
6
+console.log("server running at 8080");
singleton.js
@@ -0,0 +1,14 @@
+var singleton=function(name){
+ this.name=name;
+ this.instance=null;
+}
+singleton.prototype.getName=function(){
+ alert(this.name);
7
8
+singleton.getInstance= function(name){
9
+ if(!this.instance){
10
+ this.instance= new singleton(name);
11
+ }
12
+ return this.instance;
13
14
+
0 commit comments