Skip to content

Home > robinson > isBoolean

isBoolean() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

函数“isBoolean”检查值是否为布尔类型。

Signature:

typescript
declare function isBoolean(value: any): boolean;
declare function isBoolean(value: any): boolean;

Parameters

ParameterTypeDescription
valueany参数“value”可以是任何数据类型。

Returns:

boolean

{boolean} 函数 isBoolean 返回一个布尔值。

Example

JavaScript
   let boo = true;
   isBoolean(boo) // true
   let str = "true";
   isBoolean(boo) // false
   let boo = true;
   isBoolean(boo) // true
   let str = "true";
   isBoolean(boo) // false

Released under the MIT License.