Difference between revisions of "JavaScript"

From Conservapedia
Jump to navigation Jump to search
(Visibility of class members)
(used only for client-side programming)
Line 1: Line 1:
−
'''JavaScript''' is a [[programming language]] used for [[website|web]] development. While it is primarily used as a scripting language, it has some [[object-oriented]] features.<ref>[http://mckoss.com/jscript/object.htm Object Oriented Programming in JavaScript] - Mike Koss</ref>
+
'''JavaScript''' is a [[programming language]] used for [[website|web]] development. While it is primarily used as a scripting language, it has some [[object-oriented]] features.<ref>[http://mckoss.com/jscript/object.htm Object Oriented Programming in JavaScript] - Mike Koss</ref> It is used only for [[client-side]] programming; for a good [[server-side]] language, see [[PHP]].
  
 
==Visibility of class members==
 
==Visibility of class members==

Revision as of 13:29, February 8, 2010

JavaScript is a programming language used for web development. While it is primarily used as a scripting language, it has some object-oriented features.[1] It is used only for client-side programming; for a good server-side language, see PHP.

Visibility of class members

There are two sets of variables associated with any object you define in JavaScript. The first set of variables defined with the this keyword, are all public. The second set of variables, defined with the var keyword, are private. You can even use the same name for a public and private variable, and JavaScript can tell them apart.

Accessing public and private variables

Use regular dot notation to get the public variables of an object

  • shape.size

Within class functions, use this to get a public variable, and omit to get a private variable!


Notes

External Links

Javascript Tutorial