ThePlace

Home ] Search ] Resources ] Site Map ] Contact Me ]
Dave's Information Technology Resource

Up ]

JavaScript Background ] [ JavaScript Language ]

--- JavaScript Language ---

Data Types

JavaScript support three primitive data types:

  1. Boolean - true, false
  2. Number - all numbers
    1. Integers
    2. Hex and Octal
    3. Floating Point
  3. String - typically quoted

JavaScript also supports two composite data types:

  1. Object
  2. Arrays (of numbers, strings, Boolean, objects)

In addition JavaScript supports two trivial data types:

  1. Null
  2. Undefined

Functions in JavaScript may be used to return data.

JavaScript is a weakly typed language in that ALL variables are not declared as a specific data type. 

Functions

JavaScript has two types of functions:

  1. User-defined - created by the user (can include a unique name, input parameters, and returned data).
  2. Built-in - including the following:
bulletEscape - encodes the string that is contained in the string argument to make it portable (a string is considered portable if it can be transmitted across any network to any computer that supports ASCII characters).  To make a string portable, characters other than the following 69 ASCII characters must be encoded:
 
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
1234567890
@*-_+./
 
All other characters are converted either to their two digit (%xx) or four digit (%uxxxx) hexadecimal equivalent.
bulletEval - evaluates and/or executes a string of JavaScript code.
bulletisFinite - used to determine if an argument is a finite and legal number.
bulletisNaN - used to determine if an argument is a NaN.
bulletNumber - converts the object argument to a string representing the object's value, if the value cannot be represented by a legitimate number, the "Not-a-Number" value, NaN is returned.
bulletparseFloat - determines if the first character in the string argument is a number, parses the string from left to right until it reaches the end of the number, discards any characters that occur after the end of the number, and finally returns the number as a number (not as a string).
bulletparseInt - find the first integer in a string.  There are two arguments. The mandatory string argument is the string which is presumed to contain an integer. The optional radix argument specifies the base of the integer and can range from 2 to 36. For example, 16 is the hexidecimal base (0123456789ABCDEF).
bulletString - converts the object argument to a string representing the object's value.
bulletUnescape - decodes an encoded string argument that was created using the escape function

Objects

Many of these are/can be named objects (you can define a local name, e.g., var mystring = "hello world", mystring is a string object).

bulletAnchor - target of a hyperlink
bulletApplet - embedded applet in a web page (often Java)
bulletArea - same as a link
bulletArray - built-in support for arrays, includes length property; also includes concat, join, pop and other methods.
bulletBoolean - support for boolean values
bulletButton - graphic pushbutton
bulletCheckbox - graphic checkbox
bulletDate - manipulate date and time values
bulletDocument - HTML document window management, numerous properties for document objects (links, forms, etc.); includes write method for output to browser window
bulletEvent - details about an event
bulletFileUpload - file upload for form input
bulletForm - HTML input form (typically superior to form objects)
bulletFrame - type of window object
bulletFunction - a JavaScript function
bulletHidden - hidden data field access
bulletHistory - URL history of the browser
bulletImage - image in a web browser document
bulletLayer - independent layer in a DHTML document
bulletLink - hypertext link
bulletLocation - represents and controls browser location (current URL, host port, and protocol information)
bulletMath - manages mathematical functions (absolute value, trig functions, random, round, etc.) and constants (.E, .LN10, .PI, etc.) . 
bulletNavigator - information about the current browser (type, platform, etc.).
bulletNumber - support for numbers (convert to string, is a number).
bulletObject - superclass that contains features of all JavaScript objects.
bulletOption - an option in a select box.
bulletPassword - specialized input box.
bulletRadio - graphical radio button.
bulletReset - graphical button for resetting a form.
bulletScreen - provides information about the display.
bulletSelect - a graphical selection list.
bulletString - support for strings include replace, search, concatenation, and other manipulation methods.
bulletSubmit - graphical button for triggering a form submission.
bulletText - graphical text input field.
bulletTextarea - graphical multi-line text input area.
bulletWindow - web browser window or frame.

Operators

bulletArithmetic
   =
+, ++
-,  --
   /
   %
bulletAssignment
   =
bulletBackslash Escaped Characters
   \'
   \"
   \\
   \b
   \f
   \n (newline)
   \r
   \t
bullet Bitwise
   &
   |
   ^
   ~
   <<
   >>
   >>>
bulletComparison
   ==
   !=
   ===
   !==
   >
   >=
   <
   <=
bullet Logical
   && (and)
   || (or)
   ! (not)
bulletSpecial
   ?:
   '
   delete
   new
   this
   typeof
   void
bulletString
   +  (concatenate)

 

Statements

bulletBreak - used to terminate a current loop, switch or label statement and pass control to the statement immediately following it
bulletComment - programmer notes, they are ignored by the JavaScript interpreter
bulletContinue - restarts a while, do...while, for or label statement, in a while loop it jumps back to the condition.
bulletDo...While - executes one or more statements at least once, checking that a certain condition is met each time before repeating. If that condition is not met, then control moves to the statement immediately after the loop.
bulletExport - allows a signed script to provide properties, functions and objects to other signed or unsigned scripts.
bulletFor - creates a loop consisting of three optional expressions enclosed in brackets and separated by semicolons, and a block of statements to be executed.
bulletFor...In - used to iterate a declared variable over every property in a specified object.
bulletFunction - declares a function with its specified parameters, which can include numbers, strings and objects. To return a value, a function must have a return statement specifying the value to return.
bulletIf...Else - executes one set of statements if a specified condition is true, and another if it is false.
bulletImport - allows a script to import properties, functions and objects exported by a signed script.
bulletLabel - used to identify a statement allowing you to refer to it elsewhere in a program, typically used with the break or continue statements.
bulletReturn - specifies the value to be returned by a function and performs the act of returning that value to where the function was called from.
bulletSwitch - tests an expression against a number of case options and executes the statements associated with the first one to match.
bulletthrow - allows the programmer to create an exception. This exception can be a string, integer, Boolean or an object.
bullettry...catch - used to test a block of code for errors. The try block contains the code to be run, while the catch block contains the code to execute if there is an error.
bulletVar - used to declare a variable, and outside of a function its use is optional.
bulletWhile - creates a loop consisting of a block of statements that is executed if the expression evaluated is true.
bulletWith - establishes a default object for a set of statements. If there are any unqualified names in a set of statements, JavaScript first checks the default object to see if they exist there as properties of that object; otherwise a local or global variable is used.

Note: this page is adapted from devguru.com, javascript.com, and Microsoft resources.

 

 

Home ] Up ] Computer Architecture ] Programming Bootcamp ] Database Bootcamp ] Visual BasicS ] Web Basics ] Web Multimedia ] Web Programming ] Advanced Web Topics ] Developing Web Sites ] XML Technology ] Web Glossary ]

Copyright © 1999 - 2005 
ThePlace - Written and Sponsored by Dave Hillman