Language Tour
This chapter describes the basic building blocks of the JavaScript language without becoming bogged down in too much detail. By the end of this chapter, you will be familiar with the basic features that the language has to offer. If a language feature isn't covered here, or the detail seems incomplete, look in the Reference Section at the back of the book. The core features of JavaScript apply to all brands and versions. There is the occasional exception, usually rare, but sometimes applying almost everywhere, especially where the "rule" has only recently been settled.
For the extremely lazy, extremely technical or merely impatient, here is a quick buzzword-laden rundown that briefly summarizes the main JavaScript language features:
-
Third generation language. JavaScript is cousin to C, Pascal, and Basic.
-
Free-formatted with C-like syntax. Careful formatting is optional, unlike FORTRAN.
-
Interpreted and loosely-typed. You don't have to wrestle with a pedantic compiler.
-
Garbage collected with no pointers. Like Java, someone else cleans up your mess.
-
Floating point numbers and Unicode strings. Like Perl, basic types are kept simple.
-
Arrays and objects. Objects are easy and informal, as in Perl, and have properties and methods.
-
Object-based, not object-oriented. Complex object features are left out , unlike C++ or Java.
-
Null
and undefined
special values. Variables and functions can be created anytime, like Perl.
-
Flexible functions. Bare statements without a
main()
will do. Variable parameters for functions.
-
Highly portable. Hardware independent, so it can run anywhere, much like Java.
-
Embeds in other software. Other software provides the input and output facilities and the substance that JavaScript scripts act on, in the form of objects.
© 1997 by Wrox Press. All rights reserved.