HTML
parseInt(string, radix) 字串轉成整數 string argument and returns an integer string : 待轉成數字的字串。 radix : 從 2 到 36,能代表該進位系統的數字。 parseInt( "10" ,10) = parseInt("-13.00" ,10) = parseInt( "16.33" ,10) = parseInt("34 45 6",10) = parseInt("40years",10) = parseInt( "He 40" ,10) = parseInt( "15*3" ,10) = parseInt( "15e2" ,10) = parseInt( "42 " ,8) = parseInt( "42" ,16) = parseInt( "0xF" ,16) = parseInt( "0xA" ,16) = parseInt( "1111" ,2 ) =
parseFloat(string) 字串轉成浮點數 string argument and returns a floating string : 待轉成數字的字串。 parseFloat( "10" ) = parseFloat( "10.233" ) = parseFloat("-10.233" ) = parseFloat("34 45 66") = parseFloat( "0x6" ) = parseFloat("40 years") = parseFloat( "He 40" ) =
String(value) 數字轉成字串 input number into a string value : 數字。 String( 10 ) = String( -10 ) = String(10.23) = String(0xA) = String(0xff) = String(5+3) = String(5/3) = String(true) = String(false) = String(Boolean(0)) = String(Boolean(1)) = String([1,2,3,4]) = String({"name":"12"}) =
number.toString(radix) 數字作轉成字符串 Convert numbers to strings number : 數字。 radix : 可選。使用的基數 , 2/8/16 進制。 ( 10).toString( ) = (-10).toString( ) = (1.25).toString( ) = ( 15).toString( 2) = ( 15).toString( 8) = ( 15).toString(16) = (0xA).toString( ) = (0xF).toString( ) = (0xFF).toString( ) = (5+3).toString( ) = (5/3).toString( ) = Boolean(0).toString( ) = Boolean(1).toString( ) = ([1,2,3]).toString( ) = ({"name":"12"}).toString( ) =
typeof 檢驗運算元的型別 typeof type operator typeof 37 = typeof 3.14 = typeof (6+6) = typeof Math.LN2 = typeof Infinity = typeof "" = typeof " " = typeof "love" = typeof true = typeof false = typeof undefined = typeof html = typeof {a:1} = typeof [1, 2, 4] = typeof new Date = typeof {name:'john', age:34} = typeof function(){} = typeof Math.sin =
沒有留言:
張貼留言