0004 added[hypotenuseCalculator, counter, randomNumberGeneration]
This commit is contained in:
10
js/calcHypotenuse.js
Normal file
10
js/calcHypotenuse.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//https://youtu.be/8dWL3wF_OMw?t=2213
|
||||
//Calculate hypotenuse on click of Submit-button.
|
||||
document.getElementById("calcHypotenuseButton").onclick = function() {
|
||||
let a = document.getElementById("sideAVal").value;
|
||||
let b = document.getElementById("sideBVal").value;
|
||||
let c;
|
||||
|
||||
c = Math.sqrt(Math.pow(a,2) + Math.pow(b,2));
|
||||
document.getElementById("hypotenuse").innerHTML = "Hypotenuse: " + c;
|
||||
}
|
||||
Reference in New Issue
Block a user