HTML and CSS Reference
In-Depth Information
Table 5.19
Other Useful JavaScript Operators
Operator
What It Does
,
(comma)
Evaluates two expressions and returns the result of the second expression.
delete
Deletes an object, an object's property, or an element at a specified index in
an array.
function
Defines an anonymous function.
in
Returns
true
if the property is a property of a specified object.
instanceof
Returns
true
if the object is of a given object type.
new
Creates an instance of a user-defined object type or of one of the built-in
object types.
this
Keyword that you can use to refer to the current object.
void
Specifies an expression to be evaluated without returning a value.
An operator runs a forklift, finds a phone number, or performs an appendectomy. Java-
Script operators manipulate operands, any combination of numbers, strings, and Bool-
eans. This chapter covered the many JavaScript operators and the rules that govern
them, called precedence and associativity. Some of the important points you should have
derived from this chapter are:
1. What is precedence?
2. What is associativity?
3. How to evaluate the expression: 5 + 4 - 3 * (12 % 5) / 2
4. The difference between equal and identical.
5. Another way to write x++
6. The rules for the “+” operator.
7. How comparison operators work with numbers and strings.
8. How to use the logical && and || in expressions such as: true && false, 5 || 0, and
so on.
9. How to use the conditional operator.
10. What the
parseInt()
and
parseFloat()
functions are used for.