<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
<p>["Runoob","Google"] 转换为其他类型:</p>
<p id="demo" style="font-family:courier"></p>
<script>
var x = ["Runoob","Google"];
document.getElementById("demo").innerHTML =
"Number : " + Number(x) + "<br>" +
"String : " + String(x) + "<br>" +
"Boolean: " + Boolean(x);
</script>
</body>
</html>
["Runoob","Google"] 转换为其他类型:
Number : NaN
String : Runoob,Google
Boolean: true
发表评论 取消回复