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 > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to turn javascript strings into boolean, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.
javascript The method of converting a string to a Boolean value: 1. Create an HTML sample file;2. Add a script tag;3. Convert a string to a Boolean value by "Boolean(" string ");".
Operating environment of this article: Windows 7 system, Javascript version 1.8.5, Dell G3 computer.
js converts string to boolean
Boolean(); 0, null and no arguments return false, with arguments return true.
Boolean("");//Output is: falseBoolean(null);//Output is: falseBoolean(0);//Output is: false Boolean("hi");//Output is: trueBoolean(100);//Output is: trueBoolean(new Object()); //Output is: true
Related Introduction:
Creating Boolean objects
Boolean objects represent two values:"true" or "false"
The following code defines a Boolean object named myBoolean:
var myBoolean=new Boolean();
If the Boolean object has no initial value or its value is:
0
-0
null
""
false
undefined
NaN
Then the value of the object is false. Otherwise, its value is true (even when the variable value is the string "false")!
Thank you for reading this article carefully. I hope that the article "How to convert javascript strings to Boolean" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support it more and pay attention to the industry information channel. More relevant knowledge is waiting for you 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.