JavaScript | Math.abs()方法 (JavaScript | Math.abs() Method)

Math operations in JavaScript are handled using functions of math library in JavaScript. In this tutorial on Math.abs() method, we will learn about the abs() method and its working with examples.

JavaScript中的数学运算是使用JavaScript中的数学库函数处理的。 在有关Math.abs()方法的教程中,我们将学习abs()方法及其示例。

Math.abs() is a function in math library of JavaScript that is used to find the absolute value of the given number.

Math.abs()是JavaScript数学库中的函数,用于查找给定数字的绝对值。

Syntax:

句法:

    Math.abs(value);

Parameter(s):

参数:

  • value – It represents the value whose absolute value to be found.

    值 –它表示要找到其绝对值的值。

Return value:

返回值:

The return type of this method is number, it returns the absolute value of the given value.

此方法的返回类型为number ,它返回给定值的绝对值。

Examples 1: Valid inputs of the method

示例1:方法的有效输入

console.log(Math.abs(98))
console.log(Math.abs(-34.56))
console.log(Math.abs("-65"))

Output

输出量

98
34.56
65

Example 2: Input values that are invalid

示例2:输入值无效

console.log(Math.abs("Include Help"))
console.log(Math.abs([45, 65, 576]))
console.log(Math.abs([]))

Output

输出量

NaN
NaN
0

翻译自: https://www.includehelp.com/code-snippets/math-abs-method-with-example-in-javascript.aspx

JavaScript中带有示例的Math.abs()方法相关推荐

  1. JavaScript中带有示例的Math.log10()方法

    JavaScript | Math.log10()方法 (JavaScript | Math.log10() Method) Math operations in JavaScript are han ...

  2. JavaScript中带有示例的Math.max()方法

    JavaScript | Math.max()方法 (JavaScript | Math.max() Method) Math.max() is a function in math library ...

  3. JavaScript中带有示例的Math.log()方法

    JavaScript | Math.log()方法 (JavaScript | Math.log() Method) Math.log() is a function in math library ...

  4. JavaScript中带有示例的Math.round()方法

    JavaScript | Math.round()方法 (JavaScript | Math.round() Method) Math.round() is a function in math li ...

  5. JavaScript中带有示例的Math.cos()方法

    JavaScript | Math.cos()方法 (JavaScript | Math.cos() Method) Math.cos() is a function in math library ...

  6. JavaScript中带有示例的Math.PI属性

    JavaScript | Math.PI属性 (JavaScript | Math.PI Property) Math.PI is a property in math library of Java ...

  7. math.sqrt 有问题_JavaScript中带有示例的Math.sqrt()方法

    math.sqrt 有问题 JavaScript | Math.sqrt()方法 (JavaScript | Math.sqrt() Method) The Math.sqrt() method is ...

  8. 1507四舍五入c语言,JavaScript中用于四舍五入的Math.round()方法讲解

    此方法返回一个数四舍五入为最接近的整数的值. 语法 Math.round( x ) ; 下面是参数的详细信息: x: 一个数字 返回值: 返回数字四舍五入为最接近的整数的值. 例子: JavaScri ...

  9. math.ceil带小数点_JavaScript中带有示例的Math.ceil()方法

    math.ceil带小数点 JavaScript | Math.ceil()方法 (JavaScript | Math.ceil() Method) Math.ceil() is a function ...

最新文章

  1. inno setup修改properties格式内容_linux内核修炼之setup
  2. 写一个ArrayList类的动态代理类
  3. tHINKpHP认识---文件了解
  4. 如何DoDelete(Delete)中的Delete文本值传到DoDelete方法,报错信息为:Delete未定义!...
  5. 如何禁止电脑某个程序运行(强制自律)
  6. 单向链表操作之删除倒数第n个结点
  7. CF 67A - Partial Teacher
  8. 学习就是一件要耐的住寂寞放的下欲望舍的得享乐的事
  9. microsoft mysql下载_MySQL下载与安装+Jmeter
  10. NYOJ--22--素数求和问题
  11. H5调用摄像头拍照保存到服务器再把路径存到数据库中
  12. 五子棋项目结束总结_UML五子棋设计总结.doc
  13. FFmpeg — 视频剪辑、动静水印、转场特效[gl-transitions]
  14. 使用谷歌学术镜像查找英文论文、英文论文阅读
  15. 光电耦合器简单介绍以及作用
  16. KDL轨迹规划总结:(1)
  17. CSS学习之绘制几何图形
  18. 易基因|3文一览:简化甲基化测序(RRBS)技术优势及研究成果(医学+物种保护+农学)
  19. 在CSDN设置“关注博主即可阅读全文”方法增加粉丝量超简单
  20. 图片服务器之详解打war包

热门文章

  1. oracle move 换用户,Oracle move方法释放delete后的表空间
  2. 宇轩网络面试题目PHP,二十道接地气的php面试题,让你直接通过面试!就此奉上~...
  3. php mysql 索引_MySQL索引
  4. linuxpython升级3.5_linux升级python3.5到3.6
  5. go get 的不再src目录中_GO语言基础进阶教程:包的使用
  6. 64位ubuntu arm-linux-gcc,在ubuntu 64位的机器上执行arm-linux-gcc提示 no such file or directory【转】...
  7. 网页搜索帮助-禁止搜索引擎收录的方法
  8. nginx中的nginx.conf.default配置
  9. Android之仿网易V3.5新特性
  10. Chrome运行时性能瓶颈分析