An example Analysis of operators and operands of JavaScript
This article mainly introduces the relevant knowledge of "JavaScript operator and Operand instance Analysis". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "JavaScript operator and Operand instance Analysis" can help you solve the problem.
In arithmetic operations, numbers are called operands.
The operation (performed between two operands) is defined by the operator.
Operand operator Operand
7 + 8
Addition
Addition operator (+) plus:
Var x = 7
Var y = 8
Var z = x + y
Subtraction
The subtraction operator (-) subtracts.
Var x = 7
Var y = 8
Var z = x-y
Multiplication
The multiplication operator (*) multiplier.
Var x = 7
Var y = 8
Var z = x * y
Division
Division operator (/) divisor.
Var x = 7
Var y = 2
Var z = x / y
Coefficient
The coefficient operator (%) returns the remainder of division.
Var x = 7
Var y = 2
Var z = x% y
Note: in arithmetic, the division of two integers produces quotient and remainder.
Note: in mathematics, the result of modular operations is the remainder of arithmetic division.
Increment
The increment operator (+) increments the value.
Var x = 7
Xerox +
Var z = x
Decreasing
The decrement operator (- -) decrements the value.
Var x = 7
Xmuri-
Var z = x
Power
Take the power operator (*) to raise the first Operand to the power of the second Operand.
Example
Var x = 5
Var z = x * * 2; / / the result is 25
The result of x * * y is the same as that of Math.pow (XMagol y):
Example
Var x = 5
Var z = Math.pow (xPower2); / / the result is 25
This is the end of the introduction to "JavaScript operator and Operand instance Analysis". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.