In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "what are the logical operators in javascript". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the logical operators in javascript"?
There are three logical operators in js: 1. Logic and operator "& &". Return true;2, logic or operator "| |" only when both operands are true. If one of the operands is true, return true;3, logical non-operator "!". If the Operand is not true, true is returned.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
Logical operators are usually used to combine multiple expressions. The result of a logical operator is a Boolean, and there can only be two results, either true or false. The logical operators supported in JavaScript are listed in the following table:
Example of operator name & & logical and x & & y means true if both x and y are true | | logical or x | | y means true if either x or y is true! Logic is not! X means that if x is not true, it is true.
Logic and operations (& &) are AND Boolean operations. Return true only if both operands are true, otherwise return false.
Logic or operation (| |) is a Boolean OR operation. If both operands are true, or one of them is true, true is returned, otherwise false is returned.
Logical non-operation (!) is a Boolean inverse operation (NOT). As a unary operator, it is placed directly before the Operand, converting the value of the Operand to a Boolean value, then inverting it and returning it.
Example:
Var year = 2022 if / leap year is divisible by 400 or 4, but not divisible by 100. if ((year% 100! = 0) & & (year% 4 = = 0)) {console.log (year + "year is a leap year.") ;} else {console.log (year + "the year is an ordinary year.") ;}
At this point, I believe you have a deeper understanding of "what are the logical operators in javascript?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.