
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
What is a function literal in JavaScript?
A function literal is an expression that defines an unnamed function. You can try to run the following code to implement function literal in JavaScript.
Example
<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>
- Related Articles
- How do we use function literal to define a function in JavaScript?
- What is a string literal in C++?
- What is 0 (zero) - A decimal literal or An octal literal in C++
- What is Java String literal?
- What is the difference between `new Object()` and object literal notation in JavaScript?
- Is null a literal in Java?
- What is "function*" in JavaScript?
- What is the main difference between objects created using object literal and constructor function?
- What is a fat arrow function in JavaScript?
- What is function overloading in JavaScript?
- What is function() constructor in JavaScript?
- What is super() function in JavaScript?
- What is function chaining in JavaScript?
- JavaScript: How to Check if a String is a Literal or an Object?
- What is a standard for commenting a function in JavaScript?

Advertisements