JavaScript布尔类型转换

Js入门与实战 admin 507浏览
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
var a = Boolean('0');
var b = Boolean(0);
var c = Boolean('2');
var d = Boolean(null);
var e = Boolean(undefined);
var f = Boolean('')
console.log(a,b,c,d,e,f);
</script>
</body>
</html>

转载请注明:大灰牛博客 » JavaScript布尔类型转换