ES6 - Math.hypot(x1, x2,...) Function



Returns the square root of the sum of the arguments.

Syntax

Math.hypot( x1,x2.. ) ;   

Parameter

  • X1 and x2.. − represents numbers

Return Value

Returns the square root of the sum of all the numbers passed a argument

Example

console.log("---Math.hypot()---") 
console.log("Math.hypot(3,4) : "+Math.hypot(3,4)) 
console.log("Math.hypot(2,3,4) : "+Math.hypot(2,3,4))        

Output

---Math.hypot()--- 
Math.hypot(3,4) : 5 
Math.hypot(2,3,4) : 5.385164807134504           
Advertisements