Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of operators and operands of JavaScript

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report