It is a block of code and is designed to perform a particular tasks. It is executed when "something" invokes it(calls it).
It is defined with the function keywords,paranthesis(),and name.
Syntax- function name (parameter1, parameter2, parameter3) {
// code to be executed
}
You can reuse code: Define the code once, and use it many times.
You can use the same code many times with different arguments, to produce different results.
Examples- function toCelsius (fahrenheit) {
return (5/9) * (fahrenheit-32);
}
document.getElementById("check").innerHTML = toCelsius(77);