parseInt () and parseFloat ()

 1 <html lang="en">
 2 <head>
 3     <meta charset="UTF-8">
 4     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 5     <meta http-equiv="X-UA-Compatible" content="ie=edge">
 6     <title>全局函数---数值型函数</title>
 7 </head>
 8 <body>
. 9      < Script > 
10        
. 11          / * 
12 is          the parseInt (srting, radix) when the radix value of the parameter is zero, or not set this parameter
 13 is          the parseInt () will be judged according to the digital base string
 14  
15          ***
 16          If the string to 0x at the beginning, the parseInt () parses the remainder of the string will hexadecimal integer
 17          if the string starts with 0, then EcmEaScript V3 allows the parseInt () to achieve a
 18          string parsing the subsequent octal or hexadecimal system number
 19            If the string begins with numbers 1 to 9, parseInt () will resolve it to a decimal integer of
 20            string characters if legal interception legitimate start character
 21 is  
22 is          * / 
23 is         document.write (the parseInt ( ' 34 is ' ) +'<br/>')
24        document.write(parseInt('0X123')+'<br/>')
25        document.write(parseInt('string')+'<br/>')
26        document.write(parseInt('我说一只猫')+'<br/>')
27        document.write(parseInt('11 12 13 ') +'<br/>')
28         
29          / * the parseInt function specifies whether the first string is a digital string, and if so,
 30           then the string is parsed, up until the end of the digital, the digital and digital returns
 31           instead of as a string
 32           parseFloat (String) returns the converted float
 33 is          * / 
34 is          </ Script > 
35      
36  </ body > 
37 [  </ HTML >

 

Guess you like

Origin www.cnblogs.com/yuanxiangguang/p/11110130.html