Return to Snippet

Revision: 43256
at March 20, 2011 07:21 by reelfernandes


Initial Code
var a = MyClass()
	a.name = "I'm A"
	a.init()
	
var b = MyClass()
	b.name = "I'm B"
	b.init()
	
alert( a.name+", "+b.name )

function MyClass()
{
	var myObject = {}
		myObject.init = com_myclass_init
		myObject.name = ""
	return myObject
}

// simulate namespaces & avoid nesting object methods
function com_myclass_init()
{
	alert( this.name )
}

Initial URL
oojs

Initial Description

                                

Initial Title
OOJS - Object Oriented Javascript

Initial Tags
javascript, object

Initial Language
JavaScript