Returning Values : Function Return : Function JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Function » Function Return »

 

Returning Values










JavaScript provides a return statement to return a value.

The value to be returned is placed after the keyword return.

The 'undefined' value is returned from a function if no value is specified after the keyword return or if the return statement is not used.

A value returned from a function can be assigned to a variable or used within an expression.












<html>
<SCRIPT LANGUAGE='JavaScript'>
    <!--
    function multiplyByFive(aNumber)
    {
      return aNumber*5;
    }
    document.write("3*5=",multiplyByFive(3));
    //-->
</SCRIPT>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Function
» Function Return