Skip to content

转换类型

目标类型推荐函数示例备注
整数parseInt()parseInt("3.14") 3会丢弃小数
数字Number()Number("10") 10严格转换
字符串String()String(true) "true"万能转换
布尔值Boolean()Boolean(1) true用于逻辑判断