Return to Snippet

Revision: 43258
at March 20, 2011 08:23 by reelfernandes


Initial Code
function MyClass( name )
{
	this.name = name
}

MyClass.prototype.init = function()
{
	alert( "I'm "+this.name )
}

var a = new MyClass( 'A' );
var b = new MyClass( 'B' )

	a.init()
	b.init()

Initial URL
oojs

Initial Description
using prototype to add instance methods to a Class

Initial Title
OOJS - Object Oriented Javascript pt 2

Initial Tags
javascript, object

Initial Language
JavaScript