原型 - Number.toJSON() 方法
此方法會返回一個 JSON 字串。
語法
number.toJSON();
返回值
JSON 字串。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
alert("(45).toJSON() : " + (45).toJSON() );
}
</script>
</head>
<body>
<p>Click the button to see the result.</p>
<br />
<br />
<input type = "button" value = "Result" onclick = "showResult();"/>
</body>
</html>
輸出
prototype_json_tutorial.htm
廣告