![]() In Fortran, = serves as an assignment operator: X = 2 sets the value of X to 2. The first important computer programming language to use the equal sign was the original version of Fortran, FORTRAN I, designed in 1954 and implemented in 1957. ), or to express a universal equivalence ( (x + 1)² = x² + 2x + 1). In mathematics, the equal sign can be used as a simple statement of fact in a specific case ( x = 2), or to create definitions ( let x = 2), conditional statements ( if x = 2, then. Usage in mathematics and computer programming The symbol || was used by some and æ (or œ), from the Latin word aequalis meaning equal, was widely used into the 1700s" ( History of Mathematics, University of St Andrews). "The symbol = was not immediately popular. Try the following code to implement assignment operator in JavaScript.ĭocument.write("Value of a => (a = b) => ") ĭocument.write("Value of a => (a += b) => ") ĭocument.write("Value of a => (a -= b) => ") ĭocument.- And to avoid the tedious repetition of these words: "is equal to" I will set as I do often in work use, a pair of parallels, or duplicate lines of one length, thus: =, because no 2 things can be more equal. Note − Same logic applies to Bitwise operators so they will become like >=, >=, &=, |= and ^=. It takes modulus using two operands and assigns the result to the left operand. It divides the left operand with the right operand and assigns the result to the left operand. It multiplies the right operand with the left operand and assigns the result to the left operand. It subtracts the right operand from the left operand and assigns the result to the left operand. It adds the right operand to the left operand and assigns the result to the left operand. JavaScript supports the following assignment operators − Sr.No.Īssigns values from the right side operand to the left side operandĮx: C = A + B will assign the value of A + B into C Try the following code to implement Bitwise operator in JavaScript. This operator is just like the > operator, except that the bits shifted in on the left are always zero. The left operand’s value is moved right by the number of bits specified by the right operand. It is a unary operator and operates by reversing all the bits in the operand.īinary Right Shift Operator. Exclusive OR means that either operand one is true or operand two is true, but not both. It performs a Boolean exclusive OR operation on each bit of its integer arguments. It performs a Boolean OR operation on each bit of its integer arguments. It performs a Boolean AND operation on each bit of its integer arguments. JavaScript supports the following bitwise operators −Īssume variable A holds 2 and variable B holds 3, then − Sr.No. ![]() Try the following code to learn how to implement Logical Operators in JavaScript. If a condition is true, then the Logical NOT operator will make it false. Reverses the logical state of its operand. If any of the two operands are non-zero, then the condition becomes true. If both the operands are non-zero, then the condition becomes true. ![]() JavaScript supports the following logical operators − Set the variables to different values and different operators and then try. The following code shows how to use comparison operators in JavaScript. JavaScript supports the following comparison operators −Ĭhecks if the value of two operands are equal or not, if yes, then the condition becomes true.Ĭhecks if the value of two operands are equal or not, if the values are not equal, then the condition becomes true.Ĭhecks if the value of the left operand is greater than the value of the right operand, if yes, then the condition becomes true.Ĭhecks if the value of the left operand is greater than or equal to the value of the right operand, if yes, then the condition becomes true.Ĭhecks if the value of the left operand is less than or equal to the value of the right operand, if yes, then the condition becomes true. Set the variables to different values and then try. The following code shows how to use arithmetic operators in JavaScript. Note − Addition operator (+) works for Numeric as well as Strings. Outputs the remainder of an integer division Subtracts the second operand from the first JavaScript supports the following arithmetic operators −Īssume variable A holds 10 and variable B holds 20, then − Sr.No. Lets have a look on all operators one by one. JavaScript supports the following types of operators. Here 4 and 5 are called operands and ‘+’ is called the operator. Let us take a simple expression 4 + 5 is equal to 9.
0 Comments
Leave a Reply. |