Loading…

How to create a function in Javascript?

The javascript function is a block of code which can be designed according to the user to perform a particular task. A basic JavaScript function syntax is mentioned below:

Example

                                        

function myFunction(p1, p2) {

return p1 * p2; // The function returns the product of p1 and p2

}

Suggest An Answer

No suggestions avaliable!

Latest post from Javascript interview questions

Ask Question