Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the special character operations in JavaScript

Shulou Source: shulou.com Published: 2022-06-03 18:28:36 09月20日 Update

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-

Tags: Operations arrows functions articles special two operators characters that is Boolean form scope support familiarity surprise worth mentioning this is not bright spot code Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Redmi Xiaomi MariaDB Huawei