Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Function Declaration vs. Function Expression</title> </head> <body> <script> declaration(); // Prints: Hi, I'm a function declaration! function declaration() { document.write("Hi, I'm a function declaration!"); } expression(); // Uncaught TypeError: undefined is not a function var expression = function() { document.write("Hi, I'm a function expression!"); } </script> </body> </html>