当前位置: 首页 > 网络学院 > 客户端脚本教程 > JavaScript > JS Boolean

JavaScript
JS数学对象参考
JS字符串对象参考
JS函数参考
JS事件参考
Javascript 常用正则表达式
FF和IE下的js兼容性问题
jQuery 简单介绍
jQuery / 核心 / $(expression, [context] ) 函数
jQuery / 核心 / $(html) 函数
如何使用JS来判断浏览器类型(ie、firefox,等等)
Javascript在IE和FireFox中的不同表现
3个js字符编码函数区别
javascript 中的 XMLDOM 对象

JavaScript 中的 JS Boolean


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 697 ::
收藏到网摘: n/a

The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).
布尔对象用来把一个非布尔型的值转换为布尔值(真或假)


Examples
举例

Check Boolean value [检查布尔对象]
Check if a Boolean object is true or false.
检查布尔对象(返回的值)是真还是假

Tip: You will find more examples in the Boolean object reference - look at the bottom of this page!
提示:你将在页底的Boolean object reference找到更多的例子!


Boolean Object
布尔对象

The Boolean object is an object wrapper for a Boolean value.
布尔对象是布尔值的包装对象。

The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).
布尔对象是用来将非布尔型的值转换成一个布尔值(真或假)

We define a Boolean object with the new keyword. The following code line defines a Boolean object called myBoolean:
我们用一新关键字定义一个布尔对象。下面的代码定义了一个名为myBoolean的布尔对象:

var myBoolean=new Boolean()

Note: If the Boolean object has no initial value or if it is 0, -0, null, "", false, undefined, or NaN, the object is set to false. Otherwise it is true (even with the string "false")!
注意:如果布尔对象没有初始值或是0,-0,null,"",false,无定义的,或NaN,对象就设置为假.不然它就是真(哪怕是字符串值为"false")

All the following lines of code create Boolean objects with an initial value of false:
下面所有的代码建立的布尔对象的值都为false(假):

var myBoolean=new Boolean()
var myBoolean=new Boolean(0)
var myBoolean=new Boolean(null)
var myBoolean=new Boolean("")
var myBoolean=new Boolean(false)
var myBoolean=new Boolean(NaN)

And all the following lines of code create Boolean objects with an initial value of true:
下面的就全为true(真):

var myBoolean=new Boolean(true)
var myBoolean=new Boolean("true")
var myBoolean=new Boolean("false")
var myBoolean=new Boolean("Richard")

 


Complete Boolean Object Reference
完整的布尔对象参考

For a complete reference of all the properties and methods that can be used with the Boolean object, go to our complete Boolean object reference.
Date[日期]对象中的所有属性和方法参数,我们将在 完整布尔对象参数 中罗列说明。

The reference contains a brief description and examples of use for each property and method!
我们将列举简要说明和典型案例来讲解每个参数的属性和方法的用法

评论 (0) All

登陆 | 还没注册?