Skip to content

Instantly share code, notes, and snippets.

@erwan
Created January 23, 2012 20:03
Show Gist options
  • Save erwan/1665261 to your computer and use it in GitHub Desktop.
Save erwan/1665261 to your computer and use it in GitHub Desktop.
CommonJS in Play Framework
var Person = require("person").Person;
var alan = new Person("Alan Turing", 30);
alert(alan.hello());
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