Created
November 6, 2010 10:14
-
-
Save 5v3n/665322 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 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))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generated from gist 665319 with coffeescript. JavaScript elegance included ;-).