Archive for October, 2007

L Low (Abyss web server) order bit (Definition) See also:

Wednesday, October 17th, 2007

L Low order bit (Definition) See also: double, float, Integer, java.lang.Long, LiveConnect, Reserved word, short Cross-references: ECMA 262 edition 2 section 7.4.3 ECMA 262 edition 3 section 7.5.3 Low order bit (Definition) The least significant bit in an integer value. 1 1 1 1 1 0 0 0 See also: Bit, Bit-field, Bitwise operator, byte LValue (Definition) LValues are placed on the left of an assignment. Availability: ECMAScript edition 2 An LValue is that expression or identifier reference that can be placed on the left hand side of an assignment. An LValue must be a modifiable entity. These are called Left-Hand-Side expressions in the ECMA standard. The C language refers to these as Locator Values. = (Assign), Add then assign (+=), Assign value (=), Assignment expression, Bitwise AND then assign (&=), Bitwise OR then assign (|=), Bitwise shift left then assign (<<=), Bitwise shift right and assign (>>=), Bitwise unsigned shift right and assign (>>>=), Bitwise XOR and assign (^=), Concatenate then assign (+=), Conversion, Divide then assign (/=), Left-Hand-Side expression, Multiply then assign (*=), Property value, Remainder then assign (%=), RValue See also: Cross-references: ECMA 262 edition 2 section 11.2 ECMA 262 edition 3 section 11.2 1377

Web design service - JavaScript Programmer’s Reference This is the truth table

Wednesday, October 17th, 2007

JavaScript Programmer’s Reference This is the truth table for two Boolean primitive values being operated on with the XOR operator. A B XOR false false false false true true true false true true true false Example code:

A B XOR
See also: Bitwise XOR (^) long (Reserved word) Reserved for future language enhancements. The inclusion of this reserved keyword in the ECMAScript standard suggests that future versions of ECMAScript may be more strongly typed. This keyword also represents a Java data type and the long keyword allows for the potential extension of JavaScript interfaces to access Java applet parameters and return values. 1376

Make web site - L Logical XOR (Operator/logical) Example code: A

Tuesday, October 16th, 2007

L Logical XOR (Operator/logical) Example code:

A B OR
See also: Associativity, Binary logical operator, Logical operator, Operator Precedence Cross-references: ECMA 262 edition 2 section 11.11 ECMA 262 edition 3 section 11.11 Logical XOR (Operator/logical) Logically exclusive OR of two values. There isn’t really an XOR logical operator, but the Bitwise XOR operator should work fine. This is proven by evaluating the truth table in the example. This seems to work fine even on MSIE where the sign bit exhibits some instability under Bitwise operations. 1375

JavaScript Programmer’s Reference Logical (Web host sites) OR (||) (Operator/logical) Logical

Monday, October 15th, 2007

JavaScript Programmer’s Reference Logical OR (||) (Operator/logical) Logical OR of two operands. ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server 2.0 Opera 3.0 Availability: Property/method value type: Boolean primitive JavaScript syntax: -anOperand1 || anOperand2 anOperand1Argument list: A Boolean value anOperand2 Another Boolean value Traditionally in programming environments, the logical OR operator yields true when either or both of the operands are true. It yields false only when both are false. However, the specifics of this are slightly different in JavaScript and although the results may appear to be functionally the same, there is a subtle but important difference. First, lets deal with the normal and expected behavior of a Logical OR operator. The truth table shows the result of this operator for two Boolean primitive values: A B OR false false false false true true true false true true true true Now, the implementation is expected to conform to the ECMA standard. This sets out the following method of evaluation for a Logical OR operator: . Evaluate and convert the first operand using the ToBoolean() method. . If it is true, then return that operand. . Otherwise evaluate and return the second operand. To all intents and purposes the external perceived behavior is the same because another ToBoolean() conversion is likely to take place in the context that the expression is used an if() statement or an outer logical expression for example. The associativity is from left to right. Refer to the operator precedence topic for details of execution order. 1374

L Logical operator (Definition) Operator Description &&

Sunday, October 14th, 2007

L Logical operator (Definition) Operator Description && Logical AND || Logical OR ! Logical NOT == Equal to != NOT equal to < Less than <= Less than or equal to > Greater than >= Greater than or equal to The Boolean constants true and falseneed to be considered too, because they are often used in conditional tests to force the conditions to be trueor false. Although they are not operators as such they can be useful when constructing expressions for debugging purposes. Type conversions indicate these relationships: . false becomes 0 . true becomes 1 . 0 becomes false . Any non-zero value becomes true Note that this is going to lose some information if you convert a non-zero value other than 1 to a Boolean value and back again. Warnings: . This is not to be confused with the bitwise operators, which yield a 32-bit integer value instead of the Boolean value yielded by a logical expression. . The bitwise operators may yield a value that in other languages is the same as the logical operator. However although in C language, true and false are really integer values, in JavaScript the Boolean and Number values are distinctly different types. . Be careful to use the correct number of ampersands, and vertical bars to select the logical version of the operator. Refer to the Bitwise operator topic for a list of operators to avoid in logical expressions. Associativity, Binary logical operator, Bitwise operator, Equal to (==), Expression, Greater than (>), Greater than or equal to (>=), Identically equal to (===), Less than (<), Less than or equal to (<=), Logical AND (&&), Logical NOT complement ( !), Logical OR (||), NOT Equal to (!=), NOT Identically equal to (!==), Operator, Operator Precedence, ToBoolean, Type, Type conversion See also: Cross-references: ECMA 262 edition 2 section 11.11 ECMA 262 edition 3 section 11.11 Wrox Instant JavaScript page 19 1373

JavaScript Programmer’s Reference document.write(”"); document.write(Boolean(a)); document.write(”"); document.write(Boolean(!a)); document.write(”"); (Web site domain)

Sunday, October 14th, 2007

JavaScript Programmer’s Reference document.write(”“); document.write(Boolean(a)); document.write(”“); document.write(Boolean(!a)); document.write(”“); } See also: Associativity, Bitwise NOT complement ( ~), Logical operator, NOT Equal to (!=), Operator Precedence, Unary expression, Unary operator Cross-references: ECMA 262 edition 2 section 11.4.9 ECMA 262 edition 3 section 11.4.9 Logical operator (Definition) An operator that creates a logical (Boolean) expression. Availability: Property/method value type: ECMAScript edition 2 Boolean primitive Logical operators perform a one bit operation on the Boolean value of the operands. The input values may not be Boolean values but will be converted to a Boolean value using the toBoolean rules for that type. The conversion happens automatically but may not always be what you expect. The JavaScript interpreter is also quite smart, in that it can for some operator and value combinations perform a lazy evaluation. For example if an expression like this is presented: A AND B Then if A is false, B does not need to be evaluated to know that the result will be false. This can significantly speed up the interpreter because evaluating B might have involved an object reference or perhaps an expression evaluation. It almost always would involve a type conversion from some other type to a Boolean value. This suggests you may effect some performance gains by coding your logical operations to take advantage of this. There are specific logical operators in the set for performing logical AND as well as logical OR operations. However, generally speaking any operator that yields a Boolean result could be used in the same place. The following table summarizes the logical operators as well as those, which come under that general heading of providing a Boolean result: 1372

L Logical NOT complement (!) (Net web server) (Operator/logical)

Saturday, October 13th, 2007

L Logical NOT complement (!) (Operator/logical) Logical NOT complement (!) (Operator/logical) Logical NOT operator. Availability: ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server 2.0 Opera 3.0 Property/method value type: Boolean primitive JavaScript syntax: -!anOperand Argument list: anOperand A Boolean value to be complemented The result is the Boolean complement of the operand value. The exclamation mark is the logical negation operator. The operand is evaluated and its result converted to a binary value. The value is then reversed and used to replace the expression in whatever context it has been used. The truth table shows the result of this operator for a Boolean primitive value: A NOT false true true false Although this is classified as a logical operator here, it is also classified as a unary operator since it only has one operand. The associativity is from right to left. Refer to the operator precedence topic for details of execution order. Example code:

A NOT
See also: Associativity, Binary logical operator, Bitwise AND (&), Bitwise AND then assign (&=), Logical expression, Logical operator, Operator Precedence Cross-references: ECMA 262 edition 2 section 11.11 ECMA 262 edition 3 section 11.11 1369

JavaScript Programmer’s Reference Logical AND (&&) (Operator/logical) Logical (Business web site)

Thursday, October 11th, 2007

JavaScript Programmer’s Reference Logical AND (&&) (Operator/logical) Logical AND of two operands. ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server 2.0 Opera 3.0 Availability: Property/method value type: Boolean primitive JavaScript syntax: -anOperand1 && anOperand2 anOperand1Argument list: A Boolean value anOperand2 Another Boolean value Traditionally in programming environments, the logical AND operator yields true only when both operands are true. However, the specifics of this are slightly different in JavaScript, and although the results may appear to be functionally the same, there is a subtle but important difference. First, lets deal with the normal and expected behavior of a Logical AND operator. The truth table shows the result of this operator for two Boolean primitive values: A B AND false false false false true false true false false true true true Now, the implementation is expected to conform to the ECMA standard. This sets out the following method of evaluation for a Logical AND operator: . Evaluate and convert the first operand using the ToBoolean() method. . If it is false, then evaluate and return the second operand. . Otherwise return the evaluation of the first operand. To all intents and purposes the external perceived behavior is the same because another ToBoolean() conversion is likely to take place in the context that the expression is used an if() statement or an outer logical expression for example. The associativity is from left to right. Refer to the operator precedence topic for details of execution order. The result is the Boolean value trueif both operands are true, otherwise Boolean false is returned. 1368