Skip to content

Instantly share code, notes, and snippets.

@5v3n
Created November 6, 2010 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5v3n/665322 to your computer and use it in GitHub Desktop.
Save 5v3n/665322 to your computer and use it in GitHub Desktop.
var MyMath, myMath, sys, x;
sys = require('sys');
MyMath = function() {};
MyMath.prototype.square = function(x) {
return x * x;
};
MyMath.prototype.cube = function(x) {
return this.square(x) * x;
};
myMath = new MyMath();
x = 3;
sys.puts("square(" + (x) + ") = " + (myMath.square(x)));
sys.puts("cube(" + (x) + ") = " + (myMath.cube(x)));
@5v3n
Copy link
Author

5v3n commented Nov 6, 2010

Generated from gist 665319 with coffeescript. JavaScript elegance included ;-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment