Created
January 23, 2012 20:03
-
-
Save erwan/1665261 to your computer and use it in GitHub Desktop.
CommonJS in Play Framework
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").Person; | |
var alan = new Person("Alan Turing", 30); | |
alert(alan.hello()); |
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
function Person(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
Person.prototype.hello = function() { | |
return "Hello, my name is " + this.name + " and I'm " + this.age + " years old"; | |
} | |
exports.Person = Person |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment