Posted in

PRACTICAL :- 8 Return Function

  Return Function 

return स्टेटमेंट यह बतलाता है कि function क्या value return करता है।

<html>

    <head>

        <script type=”text/javascript”>

            function product(a,b);

            {

            return a*b;

            }

        </script>

    </head>

    <body>

        <script type=”text/javascript”> document.write(“the product is” +product(4,3));

        </script>

    </body>

</html>

output:-

the product is 12

function a तथा b का गुणन return कर रहा है। फंक्शन के अंदर डिक्लेअर किए गए वेरिएबल का जीवनकाल के जीवन काल तक ही सीमित होता है। लोकल वेरिएबल्स का अवलोकन सिर्फ फंक्शन में होगा जिसके लिए वह लोकल है एक वेरिएबल विभिन्न फंक्शन में अलग वैल्यूज रख सकते हैं।

Leave a Reply

Your email address will not be published. Required fields are marked *