Hi all, I'm a beginner working on a script for the Pythagorean theorem using JavaScript. This assignment requires me to create a functional code that when the button "Compute C!" is clicked, it will display the values of the Triangle within the HTML.

Two things I'm struggling with at the moment:

1. Getting the code to even display on the page (when I click it, somehow nothing happens)
2. Passing a, b, c to displayResult() when the function is called (still a bit confused about the concept of transferring values from arguments to parameters)

I have this script so far:

<!doctype html>
<html lang="en">
<head>
<title> Functions </title>
<meta charset="utf-8">
<script>
window.onload = init;

function init() {
var button = document.getElementById("submit");
button.onclick = pythagoras;
}

function pythagoras(a, b, c) {
var a = parseFloat(document.getElementById("a").value);
var b = parseFloat(document.getElementById("b").value);
var c = Math.sqrt(a*a + b*b);
return a, b, c;
}

function displayResult(a, b, c) {
var div = document.getElementById("result");
div.innerHTML = "Triangle: a = " + a + ", b = " + b + ", c = " + c;
}
</script>
</head>
<body>
<form>
<label for="a">Enter lengths for sides a: </label>
<input type="number" id="a" size="3">
<label for="b"> and b: </label>
<input type="number" id="b" size="3"> <br>
<input type="button" id="submit" value="Compute c!">
</form>
<div id="result">
</div>
</body>
</html>

Thanks for your help!