1. 首页
  2. 移动开发
  3. BlackBerry
  4. JavaScript中双符号的运算详解

JavaScript中双符号的运算详解

上传者: 2020-12-13 07:44:26上传 PDF文件 28.54KB 热度 9次
一、双波浪号 var i = 5.1; var j = 5.5; console.log(~~i); // 5 console.log(~~j); // 5 作用类似Math.floor。 类似的意思是在处理正数的时候,如果处理负数就它俩就不同了: ~~-5.1 // 5 Math.floor(-5.1) // -6 ~~-5.5 // 5 Math.floor(-5.5) // -6 注: Math.ceil(x) Returns the smallest integer greater than or equal to a number. Math.floor(x) Return
下载地址
用户评论