Last active
December 14, 2015 13:59
-
-
Save civic/5097699 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var person = require("./Person") | |
var p = new person.Person('John'); | |
p.show(); | |
console.log("direct access: " + p.name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import person = module("Person"); | |
var p:person.Person = new person.Person('John'); | |
p.show(); | |
console.log("direct access: " + p.name); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var person = require("./Person_modify") | |
var p = new person.Person('John'); | |
p.show(); | |
console.log("direct access: " + p.name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node Main.js | |
John | |
direct access: John | |
$ node Main_modify.js | |
John | |
direct access: undefined | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Person = (function () { | |
function Person(n) { | |
this.name = n; | |
} | |
Person.prototype.show = function () { | |
console.log(this.name); | |
}; | |
return Person; | |
})(); | |
exports.Person = Person; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Person { | |
private name:string; | |
constructor (n:string){ | |
this.name = n; | |
} | |
show(){ | |
console.log(this.name); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Person = (function () { | |
var name; | |
function Person(n) { | |
name = n; | |
} | |
Person.prototype.show = function () { | |
console.log(name); | |
}; | |
return Person; | |
})(); | |
exports.Person = Person; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment