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.
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.
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.
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)
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.
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.
( ) | Parentheses, with innermost parentheses first |
++ and -- | Increment and decrement |
*, /, and % | Multiplication, division, and modulus |
+ and - | Addition and subtraction |
if statement: use this statement if you want to execute a set of code when a condition is true
if...else statement: use this statement if you want to select one of two sets of lines to execute
switch statement: use this statement if you want to select one of many sets of lines to execute
A way to write several lines of script and use them repeatedly as needed
An object is a real-world entity, that is described by its properties.
Properties are attributes that help differentiate one object from another. You separate an object and its property with a period.
A method is a function or action you want the object to perform. Some methods require an argument, a value given to the method. The argument is the message used in a method that is passed to the object. Arguments can be variables or literals, but it must match the method.
An event is an action that occurs, such as a user clicking a link or button.
A frame is a feature that allows a browser window to be split into smaller units.
An array is a collection of data items that is identified by a singular name.