HTML Markup | JavaScript | Java | Home & Links

Javascript Tutorial Appendices

The tutorial appendices are a synopsis of important objects, methods, properties, functions and reserved words. The terms used will help you access an appropriate reference that explains in detail what the term means.

Reserved Words

Reserved words are words that can't be used as identifiers. Many of them are keywords that have a special purpose in JavaScript.

abstract  boolean    break       byte      case          catch      char
class     const      continue    debugger  default       delete     do
double    else       enum        export    extends       false      final
finally   float      for         function  goto          if         implements
import    in         instanceof  int       interface     long       native
new       null       package     private   protected     public     return
short     static     super       switch    synchronized  this       throw
throws    transient  true        try       typeof        undefined  var
void      volatile   while       with

To avoid unnecessary debugging problems NEVER use any property or method name as a variable name. Also avoid using a case variant even when it is legal (eg. do not use instanceOf).

Built-In Functions

JavaScript includes several useful built-in functions. For example:

escape() Many special characters cause problems when submitting information to a CGI server. These characters include $ # ! spaces and tabs. Example: coded=escape('& '); [returns "%26%20"].
eval() Evaluates a string and executes it as if it was script code. This can be very dangerous!
isFinite() Tests whether the variable is a finite number. Returns false if contents is not a number or is infinite. Example: flag = isFinite(var_name);
isNaN() Tests whether the variable is not a number. Returns true if contents is not a decimal based number. Example: flag = isNaNum(var_name);
Number() Converts the object's argument to a number representing the object's value. If the value cannot be represented by a legitimate number, the "Not-a-Number" value, NaN is returned.
Note the inconsistency in case!!
parseFloat() Turns a string into a floating-point number. If the first character can't be converted the result is NaN. Otherwise the conversion stops at first character that can't be converted. The function is decimal base only! Example: n = parseFloat('23.45');
parseInt() Turns a string into an integer number. If the first character can't be converted the result is NaN. Otherwise the conversion stops at first character that can't be converted. If a second parameter is included, the numeric base can be binary, octal, decimal or hexadecimal. Example: n = parseInt('55',10); which places the number 55 into the base 10 variable n.
unescape() Recovers an escaped string. Example: decoded=unescape('%26%20'); [returns "& "].

new Creates a copy or instance of an object for use or modification within a program. For example now = new Date; creates a Date object called now that can be affected by all the Date properties and methods. Technically new is an operator but it works very much like a function!
this A shorthand convention to allow working with the current object method without naming it. This is used to save retyping a method name.
with A shorthand convention to allow working with the current object without naming it. This is used to save retyping a long object name. Example: is:

with (document) {
   writeln(lastmodified);
   writeln(location);
   writeln(title);
   }

ECMA Core Objects, Methods & Properties

ECMA objects are specific core objects (or internal constructs) defined by the ECMA standards committee. Some objects are used to access operating system functions. Others are used to perform data and string manipulations. The ECMA objects are Array, Boolean, Date, Error, Function, Global, Image, Math, Number, Object, RegExp and String.

DOM Objects, Methods & Properties

DOM objects are defined by w3.org standards committee.

Client Objects, Methods & Properties

Client objects are objects tied to a particular browser. This may cause some inconsistencies in syntax or use in different browsers or as versions change. Be aware that differences do exist and always test your documents. The client objects are Document, Form, History, Location, Navigator and Window.



JavaScript | Comments [jstutorx.htm:2009 09 25]