
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between var functionName() and function functionName() in JavaScript
functionDisplayOne is a function expression, however, functionDisplayTwo is a function declaration. It is defined as soon as its surrounding function is executed.
Both the ways are used to declare functions in JavaScript and functionDisplayOne is an anonymous function.
Here’s the function expression −
functionDisplayOne(); var functionDisplayOne = function() { console.log("Hello!"); };
The following is the function declaration −
functionDisplayTwo(); function functionDisplayTwo() { console.log("Hello!"); }
Advertisements