Working with JavaScript

 < Day Day Up > 

Java or JavaScript? And, what's the difference?

Java is a programming language developed and controlled by Sun Microsystems. It is proprietary, licensed, and readily available on a number of platforms.

JavaScript was developed by Netscape as a scripting language for its browsers.

The difference between Java and JavaScript is roughly the same as the difference between C/C++ and Java (or C/C++ and JavaScript). There are similar syntax requirements, and some of the names are the same (or sufficiently similar that it is easy to figure out what's what). For many years, C and C++ have been the programming languages of choice for many applications and systems. Unix, Linux, and Windows contain extensive C and C++ code. Even Firefox has thousands of C and C++ source files.

JavaScript Reference

I'm including a simple JavaScript reference here. For a more complete reference, try, which contains tutorial and reference sections. JavaScript supports operations (assignments, math, and so on), conditionals (if, loop, and so forth), objects, and functions. JavaScript statements are

  • break This immediately ends a while or for loop.

  • comment This inserts a comment into the JavaScript code.

  • continue This ends the current iteration of a loop and begins a new iteration. Essentially, it skips following statements.

  • for This is a basic looping structure in which the start, condition, and increment can be specified.

  • This iterates the variable for all properties in an object.

  • function This creates a function that can be called from multiple locations. Optionally, it returns a value.

  • if...else This is the basic conditional test block.

  • new This creates a new array, Boolean, date, functions, math, number, or string object.

  • return This returns from a function, optionally passing back a return value.

  • this This is a reference to the current object.

  • var This declares and initializes a variable. It is not an error to initialize a variable, but it is bad programming practice.

  • while This creates a conditional loop structure that is executed as long as the condition is true.

  • with This allows you to specify a default object for a collection of statements.

     < Day Day Up > 

    Firefox and Thunderbird. Beyond Browsing and Email
    Firefox and Thunderbird Garage
    ISBN: 0131870041
    EAN: 2147483647
    Year: 2003
    Pages: 245

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: