Expressions JavaScript et JavaScript Les op
- Demo
- Agrandir
- Recharger
- New window
Gratuit iPage h�bergement Web pour la premi�re ann�e MOMENT
Si vous �tes toujours � la recherche d'un fournisseur d'h�bergement Web fiable avec des tarifs abordables, pourquoi vous ne prenez pas un peu de temps pour essayer iPage, seulement avec $1.89/month, inclus $500+ Cr�dits suppl�mentaires gratuites pour le paiement de 24 mois ($45)?
Plus de 1.000.000 de clients + existisng peuvent pas avoir tort, vraiment vous n'�tes pas aussi! Plus important encore, lorsque vous enregistrez l'h�bergement web � iPage gr�ce � notre lien, nous allons �tre heureux de renvoyer un plein remboursement. C'est g�nial! Vous devriez essayer iPage h�bergement web GRATUITEMENT maintenant! Et contactez-nous pour tout ce que vous devez savoir sur iPage.
JavaScript Assignment Operators
JavaScript Assignment operators are used to assign values to JavaScript variables. In many cases or instances JavaScript Assignment Operator is used to set a variable to a literal value, for example:
var studentName = "Max"; //studentName set to Max
var aNumber = 1982; //aNumber set to 1982
var isNumber = true; //isNumber set to true
Lets consider x=10 and y=5, the table below explains the advanced use of assignment operators:
Table 1 -JavaScript Assignment Operators | |||
Operator | Example | Equivalent | Result |
= | x=y | x=5 | |
+= | x+=y | x=x+y | x=15 |
-= | x-=y | x=x-y | x=5 |
*= | x*=y | x=x*y | x=50 |
/= | x/=y | x=x/y | x=2 |
%= | x%=y | x=x%y | x=0 |
<<= | x <<= y | x = x << y | x=320 |
>>= | x >>= y | x = x >> y | x=0 |
>>>= | x >>>= y | x = x >>> y | x=0 |
&= | x &= y | x = x & y | x=0 |
|= | x |= y | x = x | y | x=15 |
^= | x ^= y | x = x ^ y | x=15 |
JavaScript Arithmetic Operators
Arithmetic operators are used to perform all the basic arithmetic operations between operands (inputs) i.e. variables and/or values.
Table 2 - JavaScript Arithmetic Operators | |||
Operator | Meaning | Example | Result |
+ | Addition | x=4+2 | x=6 |
- | Subtraction | x=4-2 | x=2 |
* | Multiplication | x=4*2x | x=8 |
/ | Division | x=5/2 | x=2.5 |
% | Modulus (remainder) | x=5%2 | x=1 |
++ | Increment | x=++5 | x=6 |
- | Decrement | x=-5 | x=4 |
JavaScript Comparison Operators
JavaScript Comparison operators are used in logical statements to determine equality or difference between variables or values. JavaScript comparison Operators evaluates to a Boolean value indicating whether its comparison is true or false. Most of JavaScript's comparison operators should be familiar to elementary mathematics Comparison Operators.
Table 3 - JavaScript Comparison Operators | |||
Operator | Meaning | Example | Result |
< | Less than | 5 < 8 | true |
<= | Less than or equal to | 8 <= 5 | false |
> | Greater than | 8 > 3 | true |
>= | Greater than or equal to | 5 >= 5 | true |
!= | Not equal to | 8 != 5 | true |
== | Equal to | 9 == 5 | false |
=== | Equal to (identical) | 5 === '5′ | false |
!== | Not equal to | 5 !== '5′ | true |
JavaScript Bitwise Shift Operators
JavaScript Bitwise Shift Operators are used to move (shift) bits around rather than set them. Bitwise shift operators take two operands. The first is the number to be shifted, and the second specifies the number of bit positions by which all the bits in the first operand are to be shifted. The direction of the shift operation is controlled by the operator used, << for left shift and >> for right shift.
Table 4 - JavaScript Bitwise Shift Operators | ||||
Operator | Description | Example | Intermediate Step | Result |
<< | Left shift | 4<<3 | 00000100 shifted to the left three spots and filled with zeros results in 00100000. | 32 |
>> | Right shift with sign extend | -9>>2 | 11110111 shifted to the right two spots and left-filled with the sign bit results in 11111101. | -3 |
>>> | Right shift with zero fill | 32>>>3 | 00100000 shifted to the right three spots and left-filled with 0 results in 00000100. | 4 |
JavaScript Logical Operators
JavaScript Logical operators are used to determine the logic between variables or values. The logical operators && (AND), || (OR), and ! (NOT) are useful to combine such values together in order to implement more complicated logic. The most common use of the logical operators is to control the flow of script execution using conditional statement.
Table 5 - JavaScript Logical Operators | ||||
&& | true if both operands evaluate true; otherwise returns false. | var x=true, y=false; alert(x && y); // displays false | ||
|| | Returns true if either operand is true. If both are false, returns false. | var x=true, y=false; alert(x || y); // displays true | ||
! | If its single operand is true, returns false; otherwise returns true. | var x=true; alert(!x); // displays false |
JavaScript Conditional Operator
JavaScript Conditional Operator evaluate eventually a condition to true or false. If expression evaluates true, if-true-statement is evaluated. Otherwise, if-false-statement is executed.
The basic syntax for JavaScript Conditional Operator:
(expression) ? if-true-statement : if-false-statement;
var x=7;
(x >> 5) ? alert("x is greater than 5") : alert("x is less than 5");
JavaScript Comma Operator
The comma operator (,) allows multiple expressions to be strung together and treated as one expression. Expressions strung together with commas evaluate to the value of the right-most expression. JavaScript Comma Operator mostly use with for condition.
var a,b,c,d;
for(i=0; i<=10; i++)
{
//Some JavaScript Statements
}
JavaScript void Operator
The void operator specifies an expression to be evaluated without returning a value.
var a=0;
a = void (d=56);
alert(a); // the value of 'a' will alert as 'undefined'
JavaScript typeof Operator
The typeof operator returns a string indicating the data type of its operand.
var a=3
var name = "I Love JavaScript";
alert(typeof a); // alert 'number'
alert(typeof name); // alert 'string'
Table 6 - JavaScript typeof Operator Return Values | ||||
Type | String Returned by typeof | |||
Boolean | "boolean" | |||
Number | "number" | |||
String | "string" | |||
Object | "object" | |||
Function | "function" | |||
Undefined | "undefined" | |||
Null | "object" |
- Sent (0)
- Nouveau
Générez vos vidéos d'entreprise par l'IA avec la voix ou simplement du texte
chatGPTaz.com
Parlez à ChatGPT dans votre langue maternelle
AppAIVidéo
Votre première application vidéo AI GRATUITE
Deepfake Video
Deepfake AI Video Maker
Deepfake
Deepfake AI Video Maker
AI Deep Fake
Deepfake AI Video Maker
AIvidio
AI Video Mobile Solutions
AIvideos
AI Video Platform & Solutions
AIvedio
AI Video App Maker
Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT
Faceswap AI en ligne
Échangez des visages, des vidéos, des photos et des GIF instantanément avec de puissants outils d'IA - Faceswap AI Online GRATUIT
Temu gratuit 500 $ pour les nouveaux utilisateurs
Claim Free Temu $500 Credit via Affiliate & Influencer Program
Crédits publicitaires TikTok gratuits
Maîtrisez les publicités TikTok pour le marketing de votre entreprise
Dall-E-OpenAI.com
Générez automatiquement des images créatives avec l'IA
chatGPT4.win
Parlez à ChatGPT dans votre langue maternelle
Premier produit d'intelligence artificielle d'Elon Musk - Grok/UN.com
Parlez au chatbot Grok AI dans votre langue
Outily.win
Centre d'outils ouvert et gratuit, utilisable par tous et pour tous, avec des centaines d'outils
GateIO.gomymobi.com
Airdrops gratuits à réclamer et à partager jusqu'à 150 000 $ par projet
iPhoneKer.com
Économisez jusqu'à 630 $ à l'achat d'un nouvel iPhone 16
Acheter le robot Tesla Optimus
Commandez votre robot Tesla Bot : Optimus Gen 2 dès aujourd'hui pour moins de 20 000 $