免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
JS整數(shù)與浮點數(shù)的轉(zhuǎn)換

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>整數(shù)與浮點數(shù)的轉(zhuǎn)換</title>
</head>

<body>
<script language="javascript" type="text/javascript">
 document.write("整數(shù)轉(zhuǎn)換函數(shù):parseInt(數(shù)據(jù),底數(shù))<br>");
 document.write("10101=>" + parseInt("10101",2)+"<br>");
 document.write("77=>" + parseInt("77",8)+"<br>");
 document.write("2A3B=>" + parseInt("2A3B",16)+"<br>");
 document.write("077=>" + parseInt("077")+"<br>");
 document.write("0X2A3B=>" + parseInt("0X2A3B")+"<br>");
 document.write("浮點數(shù)轉(zhuǎn)換函數(shù):parseFloat(數(shù)據(jù))<br>");
 var str  = "12.345";
 var str1 = str + 6;
 var str2  = parseFloat(str) + 6;
 document.write(str1 + "=>" + parseFloat(str1)+"<br>");
 document.write(str1 + "=>" + parseFloat(str2)+"<br>");
 document.write("34.89a23=>" + parseFloat("34.89a23")+"<br>");
 document.write("數(shù)字判斷函數(shù):isNaN<br>");
 document.write("4是數(shù)字:"+!isNaN(4)+"<br>");
 document.write("ffff是數(shù)字:"+!isNaN("ffff")+"<br>");
</script>
</body>
</html>

輸出:

整數(shù)轉(zhuǎn)換函數(shù):parseInt(數(shù)據(jù),底數(shù))
10101=>21
77=>63
2A3B=>10811
077=>63
0X2A3B=>10811
浮點數(shù)轉(zhuǎn)換函數(shù):parseFloat(數(shù)據(jù))
12.3456=>12.3456
12.3456=>18.345
34.89a23=>34.89
數(shù)字判斷函數(shù):isNaN
4是數(shù)字:true
ffff是數(shù)字:false

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
一篇文章帶你了解JavaScript 數(shù)值方法(下篇)
JS隨機整數(shù)的函數(shù)
封裝jQuery Validate擴展驗證方法
javascript之Number類型
js 字符串轉(zhuǎn)換數(shù)字 - PHP整理架 - PHP博客
js驗證數(shù)字
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服