An expression is a phrase of JavaScript that a JavaScript interpreter can evaluate to
produce a value. JavaScript code is made up mostly of expressions in various forms.
A variable name is a simple expression that evaluates to the value assigned to that variable.
Complex expressions are built from simpler expressions.The most common way to build a complex expression out of simpler expressions is with an operator.
using the multiplication operator * , The expression x * y evaluates to the product of the values of the expressions x and y.
in firebug , enter the following expression, it outputs the resulting value :
1 + 2; // 3
primary expressions, do not include any simpler expressions. Primary expressions in JavaScript are constant or literal values, certain language keywords, and variable references.
examples
1.23 // A number literal
"hello world" // A string literal
/pattern/ // A regular expression literal
true // Evalutes to the boolean true value
false // Evaluates to the boolean false value
null // Evaluates to the null value
this // Evaluates to the "current" object
i // Evaluates to the value of the variable i.
undefined // undefined is a global variable
You can combine any number of values and operators to create complex compound expressions. Different data types work with various operators in specific ways. we will cover important operators for Numbers, Strings, and Arrays, but since all values are true or false, it’s useful to cover the Boolean operators on their own.
Boolean Operators
produce a value. JavaScript code is made up mostly of expressions in various forms.
A variable name is a simple expression that evaluates to the value assigned to that variable.
Complex expressions are built from simpler expressions.The most common way to build a complex expression out of simpler expressions is with an operator.
using the multiplication operator * , The expression x * y evaluates to the product of the values of the expressions x and y.
in firebug , enter the following expression, it outputs the resulting value :
1 + 2; // 3
Primary Expressions
primary expressions, do not include any simpler expressions. Primary expressions in JavaScript are constant or literal values, certain language keywords, and variable references.
examples
1.23 // A number literal
"hello world" // A string literal
/pattern/ // A regular expression literal
true // Evalutes to the boolean true value
false // Evaluates to the boolean false value
null // Evaluates to the null value
this // Evaluates to the "current" object
i // Evaluates to the value of the variable i.
undefined // undefined is a global variable
Compound Expressions
You can combine any number of values and operators to create complex compound expressions. Different data types work with various operators in specific ways. we will cover important operators for Numbers, Strings, and Arrays, but since all values are true or false, it’s useful to cover the Boolean operators on their own.
Boolean Operators
No comments:
Post a Comment