博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
math.sqrt 有问题_JavaScript中带有示例的Math.sqrt()方法
阅读量:2528 次
发布时间:2019-05-11

本文共 1856 字,大约阅读时间需要 6 分钟。

math.sqrt 有问题

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

The Math.sqrt() method is inbuilt in JavaScript to find the square root of a number. In this tutorial, we will learn about the sqrt() method with examples.

JavaScript中内置了Math.sqrt()方法 ,以查找数字的平方根 。 在本教程中,我们将通过示例了解sqrt()方法

In the math library inbuilt in the JavaScript programming language. There are many methods that support mathematical operations. The sqrt() method in JavaScript is used to find the square root of the number that is passed to the method as parameters.

在JavaScript编程语言内置的数学库中。 有许多支持数学运算的方法。 JavaScript中sqrt()方法用于查找作为参数传递给该方法的数字的平方根。

Syntax:

句法:

Math.sqrt(n);

Parameter(s):

参数:

  • n – It takes only one value which is an integer whose square root is to be found.

    n –仅取一个值,该值是要找到其平方根的整数。

Return value:

返回值:

The return type of this method is number, it returns the square root of the given parameter, if the given number is negative then it returns NaN.

此方法的返回类型为number ,它返回给定参数的平方根,如果给定数字为负,则返回NaN 。

Example 1: passing integers to the sqrt() method.

示例1:将整数传递给sqrt()方法。

    Page Title    

Output

输出量

JavaScript | Math.sqrt() method | Example 1

Passing other values to the sqrt() method

将其他值传递给sqrt()方法

All the following values if passed to the sqrt() method will return NaN. Denoting not a number passed to the method: Negative numeric value, non-numeric strings, an array with multiple numeric values, empty string or array.

如果将以下所有值传递给sqrt()方法,则将返回NaN 。 不表示传递给该方法的数字:负数值,非数字字符串,具有多个数值的数组,空字符串或数组。

Example 2: passing error values to method that will return NaN.

示例2:将错误值传递给将返回NaN的方法。

    Page Title    

Output

输出量

JavaScript | Math.sqrt() method | Example 2

You can also to operations inside the method and the result of these operations will be passed to the method to calculate the square root.

您也可以在方法内部进行运算,并将这些运算的结果传递给方法以计算平方根。

Example 3: passing expressions to sqrt() method.

示例3:将表达式传递给sqrt()方法。

    Page Title    

Output

输出量

JavaScript | Math.sqrt() method | Example 3

翻译自:

math.sqrt 有问题

转载地址:http://jsxzd.baihongyu.com/

你可能感兴趣的文章
vs code调试console程序报错--preLaunchTask“build”
查看>>
蚂蚁金服井贤栋:用技术联手金融机构,形成服务小微的生态合力
查看>>
手机通话记录统计分析
查看>>
富文本编辑器比较
查看>>
端口号大全
查看>>
机器学习基石笔记2——在何时可以使用机器学习(2)
查看>>
POJ 3740 Easy Finding (DLX模板)
查看>>
MySQL 处理重复数据
查看>>
关于typedef的用法总结(转)
查看>>
hibernate could not resolve property
查看>>
【strtok()】——分割字符串
查看>>
Linux下安装rabbitmq
查看>>
曹德旺
查看>>
【转】判断点在多边形内(matlab)
查看>>
java基础之集合:List Set Map的概述以及使用场景
查看>>
Python 线程 进程 协程
查看>>
骨牌覆盖问题
查看>>
iOS语言中的KVO机制
查看>>
excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法
查看>>
响应式web设计之CSS3 Media Queries
查看>>