29 lines
		
	
	
		
			584 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			29 lines
		
	
	
		
			584 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
|   | --- | ||
|  | title: Math Sqrt | ||
|  | localeTitle: 数学Sqrt | ||
|  | --- | ||
|  | ## 数学Sqrt
 | ||
|  | 
 | ||
|  | 函数`Math.sqrt()`返回数字的平方根。 | ||
|  | 
 | ||
|  | 如果输入负数,则返回`NaN` 。 | ||
|  | 
 | ||
|  | `sqrt()`是`Math`的静态方法,因此它总是被称为`Math.sqrt()`而不是另一个对象的方法。 | ||
|  | 
 | ||
|  | #### 句法
 | ||
|  | 
 | ||
|  | `Math.sqrt(x)` ,其中`x`是数字。 | ||
|  | 
 | ||
|  | #### 例子
 | ||
|  | 
 | ||
|  | ```js | ||
|  | Math.sqrt(25); // 5  | ||
|  |  Math.sqrt(169); // 13  | ||
|  |  Math.sqrt(3); // 1.732050807568  | ||
|  |  Math.sqrt(1); // 1  | ||
|  |  Math.sqrt(-5); // NaN  | ||
|  | ``` | ||
|  | 
 | ||
|  | #### 更多信息:
 | ||
|  | 
 | ||
|  | [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt) |