Home >Web Front-end >JS Tutorial >Detailed explanation of usage techniques of javascript operators || and &&

Detailed explanation of usage techniques of javascript operators || and &&

伊谢尔伦
伊谢尔伦Original
2017-07-19 09:16:081341browse

js The AND-OR operator || && is wonderfully useful and can be used to streamline code and reduce the readability of the program.

Requirement 1.

Assume that the growth speed display regulations are as follows:
When the growth speed is 5, 1 arrow is displayed;
When the growth speed is 10, 2 arrows are displayed;
A growth rate of 12 displays 3 arrows;
A growth rate of 15 displays 4 arrows;
Others display 0 arrows.
How to implement it with code?

Requirement 2.

Assume that the growth speed display regulations are as follows:

##The growth speed is >12 and 4 are displayed Arrows;

When the growth rate is >10, 3 arrows are displayed;

When the growth rate is >5, 2 arrows are displayed;

The growth rate is >0 and 1 arrow is displayed;

The growth rate is 8409b40cd2abca0c7044010d13b835db must be within 221f08282418e2996498697df914ce4e18bb6ffaf0152bbe49cd8a3620346341.

Maybe you also discovered that another very clever thing about the author is !tags.indexOf("

The above is the detailed content of Detailed explanation of usage techniques of javascript operators || and &&. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn