In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Today, I would like to share with you the relevant knowledge of what the grammar format of the js ternary operator is. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article, let's take a look at it.
1. Js ternary operator
Also known as ternary expression. As the name implies, there are three elements of the expression.
2. Grammar
Judgment conditions? Execute when condition is true: execute when condition is false
3. Format
The ternary operator represented requires three operands.
Expression 1? Expression 2: expression 3
Note: if expression 1 is true, the result of the whole expression is the value of expression 2, if the expression false, then the result of the whole expression is the value of expression 3.
4. Use the ternary operator to determine whether an integer is odd or even
/ / let myNo=parseInt (prompt ("Please enter an integer"); / / let myRes=myNo%2==0? "the number you entered is even": "the number you entered is odd"; / / console.log (myRes). That's all about the article "what is the grammatical format of the js ternary operator?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.
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.