Logo

Programming-Idioms

History of Idiom 200 > diff from v7 to v8

Edit summary for version 8 by dx:
New JS implementation by user [dx]

Version 7

2019-09-29, 11:31:24

Version 8

2019-09-30, 14:57:04

Idiom #200 Return hypotenuse

Returns the hypotenuse h of the triangle where the sides adjacent to the square angle have lengths x and y.

Idiom #200 Return hypotenuse

Returns the hypotenuse h of the triangle where the sides adjacent to the square angle have lengths x and y.

Extra Keywords
pythagore square geometry trigo trigonometry
Extra Keywords
pythagore square geometry trigo trigonometry
Code
const h = Math.sqrt(a**2 + b**2)

// Before ES7
const h = Math.sqrt(a*a + b*b)

// Before ES6
var h = Math.sqrt(a*a + b*b)