参考 boolean()

boolean()

将数字或字符串转换为其布尔值。对于数字,任何非零值(正数或负数),其布尔值都是 true,0 的布尔值是 false。对于字符串,值 “true” 的布尔值是 true,其余都是 false。 如果传入的值是数字或字符串数组,则会返回和数组等长度的布尔数组。

示例

语法

boolean(n)

参数

n
String|Boolean|Number|Array:

value to parse

返回值

Boolean: boolean representation of value
This page is generated from the comments in src/utilities/conversion.js . Please feel free to edit it and submit a pull request!

相关参考