Making Sense of JavaScript

Making Sense of JavaScript

What JavaScript can and cannot do.

JavaScript can be used to enhance a Web page by adding: scrolling messages, animations and dynamic images, data input forms, pop-up windows, and interactive quizzes.

You cannot use JavaScript to create applets or stand-alone applications.

JavaScript vs. Java: What's the difference?

Java is a full-fledged, object-oriented programming language, that can be used to create stand-alone applications. In order to write a Java program, you must use the Java Developer's Kit (JDK).

JavaScript is a simpler language that supports less functionality, and it resides inside HTML documents. Unlike Java, JavaScript is an interpreted language in that it does not end up as an executable file.

The advantages and disadvantages of using JavaScript.

A disadvantage in using JavaScript would be that unlike HTML, JavaScript is case sensitive.

Some advantages would be JavaScript's ease of use, and the fact that it is an open language that anyone can use without purchasing a license.

The structure and use of variables, including naming conventions and variable types.

When you define a variable in JavaScript, you do not have to indicate its type. The variable assumes its type depending on the type of data it stores.

There are four rules for naming variables:

There are three types of variables: numeric (values that hold numbers), strings (values that hold words or combinations of letters and numbers), and Boolean (represent a state or condition as being True or False)

The difference between variables and literals.

Variables are used to store data or values, whereas a literal is a constant value that does not change. A literal is an actual number or character text, rather than a calculated result or value input from the keyboard.

How to set up expressions, including the rules for the order of precedence.

An expression is a formula or a way to assign values to variables. JavaScript uses a combination of variables and literals to derive other values. An expression operates by taking the values to the right-hand side of the equal sign, performing the arithmetic operation, and then storing the result in the variable on the left-hand side of the equal sign.

The mathematical order of precedence is used in evaluating an expression in JavaScript.

Order of Operations
( ) Parentheses, with innermost parentheses first
++ and -- Increment and decrement
*, /, and % Multiplication, division, and modulus
+ and - Addition and subtraction
© 2003 Kimberly Goodwin