PDA

View Full Version : It may be shocking news, but JavaScript is .....


iota
10-25-2005, 10:28 AM
:eek: :eek:
It may be shocking news, but JavaScript is a very powerful object-based (or prototype-based, whatever you wish to call it) language.
Yes, JavaScript is a powerful language, not just something that's handy for image rollovers and other corny, flashy effects.
However, very few people who have used JavaScript realize its capabilities. If you're one of these people, this tutorial is aimed at you.

Hope that this article will turn an intermediate JavaScripter who's itching to learn objects, into an expert, keen on the exciting object-oriented JavaScript world!


Want to read more ?

Go to :

http://www.sitepoint.com/article/oriented-programming-1

VortexCortex
10-26-2005, 07:17 PM
<script type="text/javascript"><!--
function myObject(){

this.publicVar = "My Name";

var privateVar = "My Phone Number";

this.publicFunction = function(txt){ //can be called from outside myObject.
alert(txt);
}

var privateFunction = function(txt){ //can be called within myObject.
alert(txt);
}

privateFunction(privateVar); //alerts: "My Phone Number"
}

myObject.publicVar = "John Doe"; //direct access to a public variable.

myObject.publicFunction("Hey There"); //alerts: "Hey There".

//--></script>


Happy OOP everyone!