1、描述
这个方法返回一个数字的平方根。 如果一个数字的值是负数,则sqrt
返回NaN
。
2、语法
其语法如下,
Math.sqrt( x ) ;
3、参数
x :一个数字
4、返回值
返回给定数字的平方根。
5、使用示例
JavaScript Math sqrt() Method
6、输出
Math.sqrt( 0.5 ) : 0.7071067811865476Math.sqrt( 81 ) : 9Math.sqrt( 13 ) : 3.605551275463989Math.sqrt( -4 ) : NaN