Javascript function

A JavaScript function is a block of code designed to perform a particular task.
A JavaScript function is executed when "something" calls it

Here is Example Of javascript function
<script>
function myfun(p,p1)
{
return p * p1;
}
document.getElementById("test").innerHTML=myfun(4,1);

</script>