What is the use of return statement inside a function in JavaScript?

JavascriptWeb DevelopmentFront End Technology

The “return” statement in JavaScript mentions a value, which you like to return. Inside a function, the value is returned to the function caller.


You can try to run the following code to implement return statement inside a function

Live Demo

         function multiply(num1, num2) {
            return num1 * num2;
         var result = multiply(5, 10);
         document.write("Multiplication: "+result);
Updated on 07-Jan-2020 08:51:24