Skip to content

Instantly share code, notes, and snippets.

@clooth
Created September 7, 2012 14:41
Show Gist options
  • Select an option

  • Save clooth/3666750 to your computer and use it in GitHub Desktop.

Select an option

Save clooth/3666750 to your computer and use it in GitHub Desktop.
class Printer
constructor: (info) ->
@name = info.name
print: () ->
console.log(@name)
printer = new Printer(name: 'Nico')
# Result:
var Printer, printer;
Printer = (function() {
function Printer(info) {
this.name = info.name;
}
Printer.prototype.print = function() {
return console.log(this.name);
};
return Printer;
})();
printer = new Printer({
name: 'Nico'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment