How to multiply two numbers with javascript function?

Javascript function is often used to carry out multiple tasks ranging from showing alert box to changing the inner html value of a webpage. Below code will create a function which will multiply two numbers passed into it and showing the result trough the alert box!

multiply(3, 4);
function multiply(a, b)
{
var factor = a * b;
alert(factor);
}

In order to use the above javascript multiply function all we need to do is to pass two numbers into that function and it will carry out it’s job accordingly.