- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Do I need to use a semicolon after every function in JavaScript?
Commonly, adding semicolons in JavaScript is optional. Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if each of your statements is placed on a separate line.
No need of a semicolon in a function declaration:
function functionname(s) { }
If the function is written as a statement, it should have a semicolon like any other statement in JavaScript:
var a = function functionname(s) { };
- Related Articles
- Why should we use a semicolon after every function in JavaScript?
- When should I use a semicolon after curly braces in JavaScript?
- Do we need to use semicolons in JavaScript?
- What does a semicolon do after a C++ class name?
- Do I need to set up SAP user for every user of module?
- How do we use function literal to define a function in JavaScript?
- What does the leading semicolon in JavaScript libraries do?
- Split a URL in JavaScript after every forward slash?
- When is a semicolon after } mandated in C++ Program?
- Why do I need Babel JS?
- How Many Exercises Do I Need?
- Possible to split a string with separator after every word in JavaScript
- How do I call a JavaScript function on page load?
- Why do we need weakMaps in Javascript?
- When do I need to call the main loop in a Tkinter application?

Advertisements