एक फंक्शन लिटरल एक एक्सप्रेशन है जो एक अनाम फंक्शन को परिभाषित करता है। JavaScript में फंक्शन लिटरल लागू करने के लिए निम्न कोड चलाएं:
उदाहरण
<html> <head> <script> <!-- var func = function(x,y){ return x*y }; function secondFunction() { var result; result = func(10,20); document.write ( result ); } //--> </script> </head> <body> <p>Click the following button to call the function</p> <form> <input type = "button" onclick = "secondFunction()" value = "Call Function"> </form> </body> </html>