為搞清楚兩者的區(qū)別,

參考了別人寫的parseInt&Number的區(qū)別:

parseInt Parses a string argument and returns an integer of the specified radix or base. 核心函數(shù) 實(shí) " /> 伦理 电影在线观看,色宅男午夜电影网站,youjizz怎么看

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

javascript parseInt與Number函數(shù)的區(qū)別

但是parseInt("08", 10)是可以返回8的。

為搞清楚兩者的區(qū)別,

參考了別人寫的parseInt&Number的區(qū)別:

parseInt
Parses a string argument and returns an integer of the specified radix or base.
核心函數(shù)
實(shí)現(xiàn)版本 Navigator 2.0: If the first character of the string specified in parseInt(string) cannot be converted to a number, returns "NaN" on Solaris and Irix and 0 on all other platforms.Navigator 3.0, LiveWire 2.0: Returns "NaN" on all platforms if the first character of the string specified in parseInt(string) cannot be converted to a number.



語(yǔ)法
parseInt(string,radix)
參數(shù)
string A string that represents the value you want to parse.
radix (Optional) An integer that represents the radix of the return value.



描述
The parseInt function is a built-in JavaScript function.
The parseInt function parses its first argument, a string, and attempts to return an integer of the specified radix (base). For example, a radix of 10 indicates to convert to a decimal number, 8 octal, 16 hexadecimal, and so on. For radixes above 10, the letters of the alphabet indicate numerals greater than 9. For example, for hexadecimal numbers (base 16), A through F are used.

If parseInt encounters a character that is not a numeral in the specified radix, it ignores it and all succeeding characters and returns the integer value parsed up to that point. parseInt truncates numbers to integer values.

If the radix is not specified or is specified as 0, JavaScript assumes the following:



If the input string begins with "0x", the radix is 16 (hexadecimal).

If the input string begins with "0", the radix is eight (octal).

If the input string begins with any other value, the radix is 10 (decimal).
If the first character cannot be converted to a number, parseInt returns "NaN".
For arithmetic purposes, the "NaN" value is not a number in any radix. You can call the isNaN function to determine if the result of parseInt is "NaN". If "NaN" is passed on to arithmetic operations, the operation results will also be "NaN".


示例
The following示例 all return 15:
parseInt("F", 16)
parseInt("17", 8)
parseInt("15", 10)
parseInt(15.99, 10)
parseInt("FXX123", 16)
parseInt("1111", 2)
parseInt("15*3", 10) The following示例 all return "NaN":

parseInt("Hello", 8)
parseInt("0x7", 10)
parseInt("FFF", 10) Even though the radix is specified differently, the following示例 all return 17 because the input string begins with "0x".

parseInt("0x11", 16)
parseInt("0x11", 0)
parseInt("0x11")
-----------------------------------------------
-----------------------------------------------
將指定對(duì)象轉(zhuǎn)換為數(shù)字。
核心函數(shù)
實(shí)現(xiàn)版本 Navigator 4.0, NETscape Server 3.0

語(yǔ)法
Number(obj)
參數(shù)
obj 一個(gè)對(duì)象。



描述
如果對(duì)象是 Date 類型的對(duì)象,Number 將返回自格林威治標(biāo)準(zhǔn)時(shí)間 1970 年 1 月 1 日起已經(jīng)經(jīng)過(guò)的毫秒數(shù),在此日期之后的是正數(shù),之前的是負(fù)數(shù)。
如果 obj 是一個(gè)沒(méi)有數(shù)字格式的字符串,Number 將返回 NaN。


示例
下面的例子將把 Date 對(duì)象轉(zhuǎn)換為數(shù)值型值:
<SCRIPT>
d = new Date ("December 17, 1995 03:24:00");
document.write (Number(d) + "<BR>");

JavaScript技術(shù)javascript parseInt與Number函數(shù)的區(qū)別,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 精品亚洲麻豆1区2区3区 | avv天堂| 国产欧美二区综合 | 热思思 | 又黄又爽又无遮挡在线观看免费 | 一个人免费观看HD完整版 | YELLOW日本动漫高清免费 | 日韩人妻无码精品久久中文字幕 | 亚洲视频在线免费 | 亚洲薄码区 | 精品国产在线观看福利 | 欧美又粗又长又大AAAA片 | 把内衣脱了把奶露出来 | 色妺妺免费影院 | 秋霞电影网伦大理电影在线观看 | 另类重口bdsm日本tv | 亚洲国产在线午夜视频无 | 美国兽皇zoo在线播放 | 寂寞夜晚视频在线观看 | 舔1V1高H糙汉| 在线视频网站www色 在线视频免费国产成人 | 欧美激情一区二区三区AA片 | 午夜视频在线瓜伦 | 麻豆最新免费版 | YELLOW免费观看2019 | 亚洲欧美精品无码一区二在线 | 小草视频免费观看在线 | 日本不卡三卡四卡 | 破女在线观看视频 | 欧美最新色p图 | 三级黄色一级视频 | 999久久久无码国产精蜜柚 | 领导边摸边吃奶边做爽在线观看 | 忘忧草高清 | 久久黄视频| 三级黄色小视频 | brazzers欧美最新版视频 | 国产XXXXXX农村野外 | 欧美黄色第一页 | 超碰视频97av | 羞羞影院午夜男女爽爽免费 |