Why does the JavaScript need to start with ";" ?
Posted
by TK
on Stack Overflow
See other posts from Stack Overflow
or by TK
Published on 2010-03-20T01:33:46Z
Indexed on
2010/03/20
1:41 UTC
Read the original article
Hit count: 421
I have recently noticed that a lot of JavaScript files on the web starts with ;
immediately following the comment section.
For example, this jQuery plugin's code starts with
/**
* jQuery.ScrollTo
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 9/11/2008
.... skipping several lines for brevity...
*
* @desc Scroll on both axes, to different values
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
*/
;(function( $ ){
Why does the file needs to start with ;
? I see this convention on server-side JavaScript files as well.
What is an advantage and disadvantage of doing this?
© Stack Overflow or respective owner