<!doctype html>
<html>
<head lang="en">
<title>Function part 1</title>
<meta charset="utf-8">
</head>
<body>
</body>
</html>
function sum(a, b) {
// this function returns a result
return a + b;
}
function displayInPage(message, value) {
// this function does not return anything
document.body.innerHTML += message + value + "<br>";
}
var result = sum(3, 4);
displayInPage("Result: ", result);
// we could have written this
displayInPage("Result: ", sum(10, 15));
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.