
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
What does the leading semicolon in JavaScript libraries do?
A function in JavaScript looks like the following:
(function(){...})()
A library in JavaScript shows a function, which begins with a semicolon, for example:
;(function ) { }
The semicolon allows to safely concatenate several JS files into one. This is to serve it faster as one HTTP request.
A leading semicolon can also be to protect from preceding code, which may have been improperly closed. A semicolon will definitely prevent this from happening.
- Related Articles
- What does a semicolon do after a C++ class name?
- What are top JavaScript animation libraries?
- Do I need to use a semicolon after every function in JavaScript?
- What does a comma do in JavaScript expressions?
- What does a +function() { } notation do in JavaScript?
- What does the exclamation mark do before the function in JavaScript?
- What does the operator || do in a var statement in JavaScript?
- What does language attribute do in tag in Javascript?
- What is the syntax for leading bang! in JavaScript function?
- What will happen if a semicolon is misplaced in JavaScript?
- What does “use strict” do in JavaScript, and what is the reasoning behind it?
- What are the rules for JavaScript's automatic semicolon insertion (ASI)?
- List of Best JavaScript libraries?
- What Does the // Operator Do?
- Remove leading zeros in array - JavaScript

Advertisements