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

How to use the javascript relational operator

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is to share with you about how to use the javascript relation operator, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

There are four relational operators we can use in js, which are similar to those learned in mathematics, so let's introduce how to use them.

1. Both operands are strings. Compare ASCII encoding (case sensitive).

'13'

< '3';返回true,比较的是ASCII码 2、一个为数字,另一个不是数字,转化为数字。 '13' < 3;返回false,先转化为Number 3、NaN与任意数值比较均返回false(既不大于也不小于和等于)。 'a' >

3; return false,'a' to Number. Compare NaN,NaN with any value and return false.

Example

Let result1 = 1 > false; console.log ("result1:" + result1); let result2 = 1 > true; console.log ("result2:" + result2); this is how to use the javascript relational operator. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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