UNPKG

@ou-imdt/utils

Version:

Utility library for interactive media development

10 lines (9 loc) 388 B
/** * Calculates the hypotenuse of a right-angled triangle given the lengths of the other two sides. * @param {number} a - The length of one of the shorter sides. * @param {number} b - The length of the other shorter side. * @returns {number} The length of the hypotenuse. */ export default function calculateHypotenuse(a, b) { return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)); }