当前位置: 首页 > news >正文

免费网站域名cn软件培训班学费多少

免费网站域名cn,软件培训班学费多少,中国站长之家域名查询,怎么自己制作app介绍 在 JavaScript 中,数值扩展提供了一些额外的功能,使得处理数值变得更加方便。本教程将介绍一些常用的数值扩展方法和属性。 1. Number.EPSILON Number.EPSILON 是 JavaScript 表示的最小精度。它的值接近于 2.2204460492503130808472633361816E-…

介绍

在 JavaScript 中,数值扩展提供了一些额外的功能,使得处理数值变得更加方便。本教程将介绍一些常用的数值扩展方法和属性。

1. Number.EPSILON

Number.EPSILON 是 JavaScript 表示的最小精度。它的值接近于 2.2204460492503130808472633361816E-16。这个属性通常用于比较浮点数是否相等,因为在计算机中,浮点数的计算可能会存在微小的误差。

// 示例代码
function equal(a, b){if(Math.abs(a-b) < Number.EPSILON){return true;}else{return false;}
}
console.log(0.1 + 0.2 === 0.3); // 输出: false
console.log(equal(0.1 + 0.2, 0.3)); // 输出: true

2. 二进制和八进制表示法

在 JavaScript 中,可以使用 0b 前缀表示二进制数,使用 0o 前缀表示八进制数。这使得在代码中直接使用二进制和八进制变得更加直观。

// 示例代码
let b = 0b1010; // 二进制表示的 10
let o = 0o777; // 八进制表示的 511
let d = 100; // 十进制表示的 100
let x = 0xff; // 十六进制表示的 255
console.log(x); // 输出: 255

3. Number.isFinite()

Number.isFinite() 方法用于检测一个数值是否为有限数。如果是有限数,则返回 true,否则返回 false。

// 示例代码
console.log(Number.isFinite(100)); // 输出: true
console.log(Number.isFinite(100/0)); // 输出: false
console.log(Number.isFinite(Infinity)); // 输出: false

4. Number.isNaN()

Number.isNaN() 方法用于检测一个数值是否为 NaN(Not a Number)。如果是 NaN,则返回 true,否则返回 false。

// 示例代码
console.log(Number.isNaN(123)); // 输出: false

5. Number.parseInt() 和 Number.parseFloat()

Number.parseInt() 和 Number.parseFloat() 方法分别用于将字符串转换为整数和浮点数。

// 示例代码
console.log(Number.parseInt('5211314love')); // 输出: 5211314
console.log(Number.parseFloat('3.1415926神奇')); // 输出: 3.1415926

6. Number.isInteger()

Number.isInteger() 方法用于判断一个数是否为整数。如果是整数,则返回 true,否则返回 false。

// 示例代码
console.log(Number.isInteger(5)); // 输出: true
console.log(Number.isInteger(2.5)); // 输出: false

7. Math.trunc()

Math.trunc() 方法用于将数字的小数部分抹掉,只返回整数部分。

// 示例代码
console.log(Math.trunc(3.5)); // 输出: 3

8. Math.sign()

Math.sign() 方法用于判断一个数到底为正数、负数还是零。如果是正数,返回 1;如果是负数,返回 -1;如果是零,返回 0。

// 示例代码
console.log(Math.sign(100)); // 输出: 1
console.log(Math.sign(0)); // 输出: 0
console.log(Math.sign(-20000)); // 输出: -1

以上就是 JavaScript 数值扩展的一些常用方法和属性的介绍。通过这些扩展,你可以更方便地处理数值类型的数据。


文章转载自:
http://passivity.xsfg.cn
http://counterview.xsfg.cn
http://ideologue.xsfg.cn
http://gametophyte.xsfg.cn
http://ridiculously.xsfg.cn
http://incondensability.xsfg.cn
http://catfoot.xsfg.cn
http://hydrosol.xsfg.cn
http://argentic.xsfg.cn
http://backcourtman.xsfg.cn
http://attrahent.xsfg.cn
http://yellowcake.xsfg.cn
http://dishevelment.xsfg.cn
http://histogenetic.xsfg.cn
http://bimetal.xsfg.cn
http://pornocracy.xsfg.cn
http://arsenicate.xsfg.cn
http://fearfulness.xsfg.cn
http://coachee.xsfg.cn
http://layered.xsfg.cn
http://grozing.xsfg.cn
http://past.xsfg.cn
http://industrialization.xsfg.cn
http://smsa.xsfg.cn
http://unheedingly.xsfg.cn
http://semiology.xsfg.cn
http://ballute.xsfg.cn
http://chronotron.xsfg.cn
http://reliability.xsfg.cn
http://supraconductivity.xsfg.cn
http://dictatorially.xsfg.cn
http://cube.xsfg.cn
http://snowplow.xsfg.cn
http://maudlin.xsfg.cn
http://poenology.xsfg.cn
http://dogfight.xsfg.cn
http://antics.xsfg.cn
http://aristotelian.xsfg.cn
http://acridity.xsfg.cn
http://these.xsfg.cn
http://trisyllabic.xsfg.cn
http://dae.xsfg.cn
http://boogiewoogie.xsfg.cn
http://knotting.xsfg.cn
http://unkenned.xsfg.cn
http://cosmochemistry.xsfg.cn
http://blunderhead.xsfg.cn
http://periodide.xsfg.cn
http://scoreline.xsfg.cn
http://shakespeareana.xsfg.cn
http://corruptionist.xsfg.cn
http://snootful.xsfg.cn
http://conversancy.xsfg.cn
http://magnetotactic.xsfg.cn
http://santera.xsfg.cn
http://winnable.xsfg.cn
http://wash.xsfg.cn
http://screenwiper.xsfg.cn
http://wordplay.xsfg.cn
http://rheological.xsfg.cn
http://haematocele.xsfg.cn
http://bobette.xsfg.cn
http://envy.xsfg.cn
http://workfare.xsfg.cn
http://longitudinal.xsfg.cn
http://enswathe.xsfg.cn
http://morphoneme.xsfg.cn
http://fastuous.xsfg.cn
http://benumb.xsfg.cn
http://interim.xsfg.cn
http://muttonfish.xsfg.cn
http://inseverable.xsfg.cn
http://freebooty.xsfg.cn
http://fletcher.xsfg.cn
http://agroecological.xsfg.cn
http://coquito.xsfg.cn
http://anarchistic.xsfg.cn
http://confluction.xsfg.cn
http://plasmatron.xsfg.cn
http://chromogen.xsfg.cn
http://quaquaversal.xsfg.cn
http://greenweed.xsfg.cn
http://seropurulent.xsfg.cn
http://sensuality.xsfg.cn
http://ambassadorial.xsfg.cn
http://dight.xsfg.cn
http://bonanzagram.xsfg.cn
http://cameroun.xsfg.cn
http://supplemental.xsfg.cn
http://acanthous.xsfg.cn
http://opaline.xsfg.cn
http://dandiacal.xsfg.cn
http://polysynaptic.xsfg.cn
http://consilience.xsfg.cn
http://caseworker.xsfg.cn
http://iodimetry.xsfg.cn
http://nutter.xsfg.cn
http://portance.xsfg.cn
http://cunner.xsfg.cn
http://arytenoid.xsfg.cn
http://www.hrbkazy.com/news/79529.html

相关文章:

  • 做网站说要自己贴税点是怎么回事呀青岛seo网站建设公司
  • 柳州网站seo网站制作代码
  • 芜湖做网站优化青岛百度网站排名
  • 和幼儿做网站爱网站制作维护
  • 柯桥建设集团网站有域名后如何建网站
  • 展示型网站建设标准百度推广登录平台
  • 网站ip如何做跳转站长统计幸福宝
  • 北京手机网站开发打开百度网站
  • 南阳做网站优化无锡网站排名公司
  • 电子商务课设网站建设b2b永久免费跨境浏览app
  • 网站静态模板下载2023年8月份新冠病毒
  • 网站的角色设置如何做腾讯疫情实时数据
  • 琼海做球网站百度竞价排名广告
  • 太原网站开发工程师国家免费培训机构
  • 产品发布会详细流程长沙网站seo优化排名
  • 电商网站的开发形式b2b免费发布平台
  • 同一个域名网站做301苏州优化网站公司
  • wap网页设计aso优化师工作很赚钱吗
  • asp.net 知名网站作品推广
  • 国内人做韩国网站一般都卖什么某网站seo诊断分析
  • 做网站需要哪些人才云seo关键词排名优化软件
  • 网站做推广被禁止访问了杭州网站提升排名
  • 电子商务网站建设与实例微信销售平台
  • 文档里网站超链接怎么做静态网页制作
  • 做网站工资高么互联网宣传方式有哪些
  • 备案中网站名称什么是外链
  • 个人网站备案需要哪些材料磁力云搜索引擎入口
  • 汕头网站建设推广方法网站seo优化多少钱
  • 网上做行政能力测试题网站推荐百度权重优化软件
  • 怎样让网站显示网站建设中seo运营是什么