educational articles
Educational Articles

Javascript Tutorials and Reference Guides



JavaScript is a scripting language created by Netscape in the late 1990s. Originally it was called LiveScript but, given the popularity of the Java programming language at the time, Netscape renamed it JavaScript hoping to capitalize on the name. In reality there are very few similarities between the two, and while JavaScript became popular the name has done little more than confuse.

  • Netscape History - The browser that gave birth to JavaScript & popularized the Web.
  • AJAX - Highly interactive application-like Web Pages using JavaScript

Four features of JavaScript


Like most languages JavaScript has operators for comparing, and modifying data. Many of JavaScripts operators are C-Like. Similar to C parentheses can be used to group operations, though without parentheses JavaScript uses an order of operations similar to that of C, which derives from operator precedence in mathematics. JavaScript also uses short circuit evaluation in comparisons. If the first part of a JavaScript statement would make certain that the whole statement would be either true or false then the remaining portion of the statement is skipped. The following are some of JavaScript operators.

  • Assignment Operators
  • = The Assignment operator assigns the value on the right to the variable on the right.
  • = The Assignment operator assigns the value on the right to the variable on the right.
  • += Increments the variable on the left by the value on the right and assigns the result to the variable on the left.
  • -= Decrements the variable on the left by the value on the right and assigns the result to the variable on the left.
  • *= Multiplies the variable on the left by the value on the right and assigns the result to the variable on the left.
  • /= Divides the variable on the left by the value on the right and assigns the result to the variable on the left.
  • %= Performs a modulus operation on the variable on the left by the value on the right and assigns the result to the variable on the left.

Comparison Operators

  • == Compares the Value on the left to the value on the right.
  • % (Modulus) Divides the first operand by the second and returns the remainder.
  • ++ (Increment) increases the value of a variable by 1.
  • -- (Decrement) decreases the value of a variable by 1.
  • - (Unary Negation) negates the value of a variable. For instance a variable with a value of 1 would become negative 1 (-1).

Bitwise Operators

Bitwise operators act on bits in memory, and treat variables as though they were binary numbers. This allows bitwise operators, like those from Assembly language, to be implemented in JavaScript programs.

In addition to the above operators, JavaScript has some special operators that are unable to be classified separately.

  • ?: The Conditional Operator - Performs an inline IF comparison.
  • , The Comma Operator - Performs multiple operations, such as assignment operations, in a single statement.
  • delete - Performs a destroy command on an object in memory.
  • new - Creates a new instance of an object.
  • this - Is used to access properties of an object within functions specific to that object.
  • void - Forces an undefined value to be returned.


Outside of using the comma operator, all JavaScript statements are separated by semi-colons, which is a common feature of c-like languages. This remains true even if multiple statements appear on the same line, or within an HTML event like the onClick handler. At the same time, because statements are delimited by semicolons, a single statement can span multiple lines which is often useful for making complex statements easier to understand and properly document.

  • break - Forces an exit to a control structure like a loop or switch.
  • delete - Deletes an object from memory.
  • do...while - Implements a DO loop, where the loop is performed at least before evaluating any conditions.
  • export - Marks object methods as public.
  • for - Performs a for loop where a control variable is assigned, compared, and incremented on every iteration.
  • - Performs a FOR loop which operates specifically on each element of an array or object.
  • function - Allows the programmer to declare their on functions.
  • import - Imports public functions of an object or class.
  • switch - Is an easy way to implement a complex if statement where only one value or condition is passed to each comparison.
  • var - Creates a new variable in memory.
  • while - Performs a loop so long as a condition remains true.
  • with - Adds objects to the scope of a loop.

Core Objects

There are a few core objects, and data types which are commonly used in JavaScript scripting. JavaScript being object oriented all data types act as objects and complex datatypes, like strings, inherit properties from simple objects like arrays. Complex objects can inherit the properties of multiple simple types as well.

  • Array - Is an object for storing Arrays, and Associative arrays dynamically
  • Boolean - Implements a Boolean data type, which has only 2 possible states
  • Date - Is an object for storing a date, and contains many functions for representing dates in different formats.
  • Function - Treats a declared function as an object
  • Number - Is an object used to treat a number differently for different operations, like decimal, real, etc.


Document properties are used to access the HTML DOM. In inter-application scripting some of these may be re-implemented to access properties of another type of document. One of the most common uses for JavaScript is manipulating DOM objects within hypertext documents. AJAX, which utilizes JavaScript to implement advance interactivity, uses the document object.

  • Document - An object representing HTML DOM.
  • Link - An object for detecting and manipulating links on a page.
  • Anchor - An object for manipulating anchor properties and detecting the coordinates of anchor text.
  • Applet - An Object for interacting with Applets, such as Java or Flash applets.


JavaScript has a separate set of objects for dealing with Windows. At first this may seem odd since there is already a document object. In fact a Window contains a Document object. The Window object deals with functionality related to or between Windows, as well as the history, and window properties like location, and size. Frames act as separate windows and have essentially the same objects.

  • Window - The basic object to control Window Properties
  • Location - Object controlling the location of the page, and methods for manipulation.
  • Frame - An object for manipulating frame objects.
  • History - An object for moving through and displaying information about a Window's History log.


The Form object deals with the properties of HTML forms. This can be used to update forms as information is entered, or to validate what information has been entered as well as offer extra options depending what kind of data has been entered.

  • Hidden - An attribute that can make a form invisible unless it is needed.
  • Text - A DOM object attribute for dealing with text.
  • Password - An object to perform secure functions on passwords.
  • FileUpload - An object to interact with apache file uploads.
  • Button - A class for use with properties of form buttons.
  • Submit - A class containing information of the submission of a form.
  • Reset - A method used to reset a form.
  • Select - A way to interact with Select menus in the DOM
call to action graphic