| HTML Tutorials |
|
|
| XML Tutorials |
|
|
| Browser Scripting |
|
|
| Server Scripting |
|
|
| .NET (dotnet) |
|
|
| Multimedia |
|
|
| Web Building |
|
|
| Java Tutorials |
|
|
| Programming Langauges |
|
|
| Soft Skills |
|
|
| Database Tutorials |
|
|
| Operating System |
|
|
| Software Testing |
|
|
| SAP Module |
|
|
| Networking Programming |
|
|
| Microsoft Office |
|
|
| Accounting |
|
|
|
|
Javascript hat folgende Arten der Operatoren. In diesem Abschnitt beschreibt die Operatoren und enth�lt Informationen �ber Operatorenrangfolge.
|
Assignment Operators
Comparison Operators
Arithmetic Operators
Bitwise Operators
Logical Operators
String Operators
|
|
Javascript hat die folgenden Arten der Operatoren. Dieser Abschnitt beschreibt die Operatoren und enth�lt Informationen �ber Operatorenrangfolge.
|
|
operand1 operator operand2
|
|
|
For example, 3+4 or x*y.
A unary operator requires a single operand, either before or after the operator:
|
|
For example, x++ or ++x.
Java Script has one ternary operator, the conditional operator. A ternary operator requires three operands.
|
| Operator type |
Individual operators |
| member |
. [] |
| call / create instance |
() new |
| negation/increment |
! ~ - + ++ -- typeof void delete |
| multiply/divide |
* / % |
| addition/subtraction |
+ - |
| bitwise shift |
<< >> >>> |
| relational |
< <= > >= in instanceof |
| equality |
== != === !== |
| bitwise-and |
& |
| bitwise-xor |
^ |
| bitwise-or |
| |
| logical-and |
&& |
| logical-or |
|| |
| conditional |
?: |
| assignment |
= += -= *= /= %= <<= >>= >>>= &= ^= |= |
| comma |
, |
|
For example, x++ or ++x.
An assignment operator assigns a value to its left operand based on the value of its right operand. The basic assignment operator is equal (=), which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x.
The other assignment operators are shorthand for standard operations, as shown in the following table.
|
| Shorthand operator |
Meaning |
| x += y |
x = x + y |
| x -= y |
x = x - y |
| x *= y |
x = x * y |
| x /= y |
x = x / y |
| x %= y |
x = x % y |
| x <<= y |
x = x << y |
| x >>= y |
x >>= y |
| x >>>= y |
x = x >>> y |
| x &= y |
x = x & y |
| x ^= y |
x = x ^ y |
| x |= y |
x = x | y |
|
Ein Comparison Operators vergleichen seine Rechengr��en und R�ckkehr, die ein logischer Wert an gr�ndete, ob der Vergleich oder nicht zutreffend ist. Die Rechengr��en k�nnen numerische, der String, logischer oder des Gegenstandes Werte sein. Strings werden gr�ndeten auf der lexikographischen Standardeinrichtung mit Unicode Werten verglichen. Wenn die zwei Rechengr��en nicht von der gleichen Art sind, versucht Javascript, die Rechengr��en in eine passende Art f�r den Vergleich, au�er dem === umzuwandeln und! == Operatoren. Dieses ergibt im Allgemeinen einen numerischen Vergleich, der durchgef�hrt wird. Die folgende Tabelle beschreibt die Comparison Operators.
|
| Operator |
Description |
Example |
| == |
is equal to |
5==8 returns false |
| === |
is equal to (checks for both value and type) |
x=5
y="5"
x==y returns true
x===y returns false |
| != |
is not equal |
5!=8 returns true |
| > |
is greater than |
5>8 returns false |
| < |
is less than |
5<8 returns true |
| >= |
is greater than or equal to |
5>=8 returns false |
| <= |
is less than or equal to |
5<=8 returns true |
|
Bitweise behandeln Operatoren ihre Rechengr��en als Satz von 32 Bits (null (0) und eine (1)), anstatt als dezimale, hexadezimale oder Oktalzahlen. Z.B. hat die dezimale Nr. neun eine bin�re Darstellung von 1001. Bitweise f�hren Operatoren ihre Betriebe auf solchen bin�ren Darstellungen durch, aber sie bringen numerische Werte des Standardjava Indexes zur�ck.
|
| Operator |
Usage |
Description |
| Bitwise AND |
a & b |
Returns a one in each bit position for which the corresponding bits of
both operands are ones. |
| Bitwise OR |
a | b |
Returns a one in each bit position for which the corresponding bits of
either or both operands are ones. |
| Bitwise XOR |
a ^ b |
Returns a one in each bit position for which the corresponding bits of
either but not both operands are ones. |
| Bitwise NOT |
~ a |
Inverts the bits of its operand. |
| Left shift |
a << b |
Shifts a in binary representation b bits to left, shifting in zeros from
the right. |
| Sign-propagating right shift |
a >> b |
Shifts a in binary representation b bits to right, discarding bits
shifted off. |
| Zero-fill right shift |
a >>> b |
Shifts a in binary representation b bits to the right, discarding bits
shifted off, and shifting in zeros from the left. |
|
Logical Operators werden gew�hnlich mit Booleschen (logischen) Werten verwendet; wenn sie sind, bringen sie einen Booleschen Wert zur�ck. Jedoch bringen das && und die || Operatoren wirklich den Wert von einer der spezifizierten Rechengr��en zur�ck, also, wenn diese Operatoren mit nicht-Booleschen Werten verwendet werden, k�nnen sie einen nicht-Booleschen Wert zur�ckbringen. Die Logical Operators werden in der folgenden Tabelle beschrieben.
|
| Operator |
Description |
Example |
| && |
and |
x=6
y=3
(x < 10 && y > 1) returns true |
| || |
or |
x=6
y=3
(x==5 || y==5) returns false |
| ! |
not |
x=6
y=3
!(x==y) returns true |
|
Zus�tzlich zu den Vergleich Operatoren die auf Stringwerten verwendet werden k�nnen, verkettet der Hintereinanderschaltung Operator (+) zwei Stringwerte zusammen sind und bringt eine andere String zur�ck, die der Anschlu� der zwei Rechengr��e Strings ist. Z.B. �mein� + �Zeichenkette� bringt die String �meine String� zur�ck.
Der StenographieZuweisungsoperator += kann auch gewohnt sein, Strings zu verketten. Z.B. wenn das variable Mystring den Wert �Alpha hat,� dann wertet der Ausdruck, der �gewettetes� += mystring ist, �Alphabet� aus und weist diesen Wert dem Mystring zu.
|
txt1="What a very"
txt2="nice day!"
txt3=txt1+txt2
|
Keywords: javascript logical operators, comparison operators, assignment operators,
bitwise operators
|
|
| HTML Quizes |
|
|
| XML Quizes |
|
|
| Browser Scripting Quizes |
|
|
| Server Scripting Quizes |
|
|
| .NET (dotnet) Quizes |
|
|
| Multimedia Quizes |
|
|
| Web Building Quizes |
|
|
| Java Quizes |
|
|
| Programming Langauges Quizes |
|
|
| Soft Skills Quizes |
|
|
| Database Quizes |
|
|
| Operating System Quizes |
|
|
| Software Testing Quizes |
|
|
| SAP Module Quizes |
|
|
| Networking Programming Quizes |
|
|
| Microsoft Office Quizes |
|
|
| Accounting Quizes |
|
|
|