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

What are WeChat Mini Programs's basic operators?

2025-01-27 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 "what are WeChat Mini Programs's basic operators". The editor shows you the operation process through an actual case, and the operation method is simple, fast and practical. I hope this article "what are WeChat Mini Programs's basic operators" can help you solve the problem.

Basic operator

Sample code:

Var a = 10, b = 20 bounding / addition operation console.log (30 = a + b); / / subtraction operation console.log (- 10 = a-b); / / multiplication operation console.log (= a * b); / / division operation console.log (= a / b); / / remainder operation console.log (10 = a% b)

The addition operation (+) can also be used as a concatenation of strings.

Var a ='.w', b = 'xs';// string concatenation console.log (' .wxs'= a + b); unary operator

Sample code:

Var a = 10, b = 20ramp / self-incrementing operation console.log (10 = + +); console.log (12 = + + a); / / self-subtractive operation console.log (12 = a Mustang -); console.log (10 =-a); / / positive operation console.log (10 = + a); / / negative operation console.log (0-10 =-a); / / No operation console.log (- 11 = ~ a); / take inverse operation console.log (false =! a) / / delete operation console.log (true = delete a.fake); / / void operation console.log (undefined = void a); / / typeof operation console.log ("number" = typeof a); bit operator

Sample code:

Var a = 10, b = 20 console.log / left shift console.log (80 = (a > 2)); / / signed right shift operation console.log (2 = (a > > 2)); / / and operation console.log (2 = (a & 3)); / / XOR operation console.log (9 = (a ^ 3)); / or operation console.log (11 = (a | 3)); comparison operator

Sample code:

Var a = 10, b = 20 / less than console.log (true = = (a)

< b));// 大于console.log(false === (a >

B)); / / less than or equal to console.log (true = (a = b)); equivalent operator

Sample code:

Var a = 10, b = 20 console.log / equal sign console.log (false = (a = = b)); / / non-equal sign console.log (true = (a! = b)); / / congruent sign console.log (false = (a = b)); / / non-equal sign console.log (true = (a! = = b)); assignment operator

Sample code:

Var a = 10 + = 10 + + = 5 + console.log (- 1 = = a); a = 10 + = 11 + console.log (- 1 = a); a = 10 +-= 11 + console.log (- 1 = a); a = 10X a = 2boot console.log (2 = = a); a = 10X a = 2th console.log (2 = = a); a = 10X a > = 2th console.log (2 = = a) A = 10; a & = 3bot console.log (2 = a); a = 10; a ^ = 3x console.log (9 = a); a = 10; a | = 3bot console.log (11 = a); binary logic operator

Sample code:

Var a = 10, b = 20 console.log / console.log (20 = (a & b)); / / logic or console.log (10 = (a | | b)); other operators

Sample code:

Var a = 10, b = 20, the console.log / conditional operator (20 = = (a > = 10? A + 10: B + 10)); / / comma operator console.log (20 = (a, b)); operator precedence operator indicates associativity 20 (...) parentheses nmp A19. . ... Member access from left to right. [.] member access from left to right. () function calls from left to right 17. + + post increment nAccord a... -- Post decrement n/a16!. The logic is not from right to left. Bitwise is not from right to left +. Unary addition from right to left. Unary subtraction from right to left + +. The front is incremented from right to left. Pre-decrement from right to left typeof... typeof from right to left void... void from right to left delete... delete from right to left 14. *. Multiply from left to right. /. Division from left to right.%. Take the mold from left to right 13. +. Addition from left to right. -. Subtract from left to right 12. ... Move bitwise right from left to right. Move unsigned right from left to right 11. =. Greater than or equal to 10 from left to right. = =. The equal sign goes from left to right. The non-equal sign is from left to right. The full equal sign is from left to right. The non-equal sign is from left to right 9. &. Bit by bit and from left to right 8. ^. Bit by bit or from left to right 7. |. Bit by bit or from left to right 6. & &. Logic and from left to right 5. | |. Logic or from left to right 4. ?...:... The conditional operator is from right to left. =. Assignment from right to left. + =. Assignment from right to left.-=. The assignment is from right to left. Assignment from right to left. / =. Assignment from right to left.% =. Assignment from right to left. =. Assignment from right to left. > > =. Assignment from right to left. Assign values from right to left. ^ =. Assignment from right to left. | =. Assignment from right to left 0. ,... Comma from left to right about "what are the basic operators of WeChat Mini Programs"? thank you for your 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