sudhakarinfotech
(current)
Run Code
Live Code Editor- Javascript Anonymous Function
Source Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Javascript Function Expression</title> </head> <body> <h1>JavaScript Function Expression Calling</h1> <p>In this example, addNumber() is a function .</p> <script> // greetMessage() ; //It will not work var greetMessage = function () { alert("Hello,i have learnt function."); }; greetMessage(); </script> <button onclick="greetMessage()">Click</button> </body> </html>
Source Code Output :
Running