Skip to content

Instantly share code, notes, and snippets.

@mimiflynn
Created July 24, 2013 19:42
Show Gist options
  • Save mimiflynn/6073820 to your computer and use it in GitHub Desktop.
Save mimiflynn/6073820 to your computer and use it in GitHub Desktop.

Example of a JS constructor

function Cuboid(x,y,z){
  this.x = x;
	this.y = y;
	this.z = z;
	this.area = function(){
		var area = this.x * this.y;
		return area;
	};
	this.volume = function(){
		var volume = this.area() * this.z;
		return volume;
	};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment