Home > Web Front-end > HTML Tutorial > What does function literal mean in JavaScript?

What does function literal mean in JavaScript?

WBOY
Release: 2023-09-05 12:17:04
forward
1264 people have browsed it

What does function literal mean in JavaScript?

A function literal is an expression that defines an unnamed function. You can try running the following code to implement function literals 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>
Copy after login

The above is the detailed content of What does function literal mean in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template