You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
programming-examples/js/Math/Pythagorean function in Jav...

8 lines
293 B
JavaScript

function pythagorean_theorem(x, y) {
if ((typeof x !== 'number') || (typeof y !== 'number'))
return false;
return Math.sqrt(x * x + y * y);
}
console.log(pythagorean_theorem(2, 4));
console.log(pythagorean_theorem(3, 4));