javascript中parseInt函数的另类写法示例说明


摘要:
下文讲述”~~” “|” “<<“操作符作为parseInt函数的用法示例说明,如下所示:

例:

  <meta charset='utf-8' />
 <p>
  maomao365.com <br />
  js parseInt函数的另类写法示例说明
 </p>
 <hr />
<script> 
var a =  ~~"3.25";
var b =  ~~"3.75";
var c =  ~~"-3.25";
var d =  ~~"-3.85";
var e =8.35|0;
var f =8.36>>0; 
var g =-8.36|0;  
var h =-8.35>>0;  

document.write("a:"+a+"<br />");
document.write("b:"+b+"<br />");
document.write("c:"+c+"<br />");
document.write("d:"+d+"<br />");
document.write("e:"+e+"<br />");
document.write("f:"+f+"<br />");
document.write("g:"+g+"<br />");
document.write("h:"+h+"<br />");
 
</script>
js parseInt函数的另类写法示例说明

js parseInt函数的另类写法示例说明