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 the special character operations in JavaScript

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

Share

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

This article mainly introduces what special character operations there are in JavaScript, which can be used for reference by interested friends. I hope you will gain a lot after reading this article.

1. What is-- >?

These two separate operators are very simple operators, such as--, which generally means self-subtraction, var I = 5 × while (I) {console.log (iMube -);}, will print out 5pm, 4pm, 3Q, 2Q 1.

What about the combination of the two?

In c,-- > indicates a tendency, that is to say,-- > 0 means a tendency to 0.

# include int main () {int x = 10; while (x-- > 0) / / x goes to 0 {printf ("% d", x);}}

So does it work in javascript as well?

Var n = 5 position while (n-- > 0) {console.log (n);}

The effect after running the console of Chrome is like this.

That is to say, this arrow function (this arrow function is not the other arrow function = >) is also applicable to javascript. Do you think this arrow function looks familiar?

Arrow symbols have existed since the birth of JavaScript, and have existed since the birth of the first one. The JavaScript tutorial recommended wrapping line scripts in HTML comments to prevent browsers that do not support JS from mistakenly displaying JS code as text.

So is there any other form of expression besides-- > this form?

Var x = 5position while (--x > 0) {console.log (x);}

We are surprised to find that-- x > can also show the nature of tendency, so what does-- x > mean?

This means decrementing x and then comparing the X and 0 > operators

At this point, we all basically understand, so we can extend a series of operators.

-- > xmuri-> 0mm + > xmuri + > 0muri-> = xmuri-> = xmuri + > = xmuri + > = 0muri-< xmure-

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