JavaScript syntax: Difference between revisions

Content deleted Content added
Line 562:
[[Space (punctuation)|Space]]s, [[tab]]s and [[newline]]s used outside of string constants are called [[whitespace]]. Unlike C, whitespace in JavaScript source can directly impact semantics. Because of a technique called "semicolon insertion", any statement that is well formed when a newline is parsed will be considered complete (as if a semicolon were inserted just prior to the newline). Programmers are advised to supply statement terminating semicolons explicitly to enhance readability and lessen unintended effects of the automatic semicolon insertion.
 
''Unnecessary whitespace'', whitespace characters that are not needed for correct syntax, can increase the amount of wasted space, and therefore the file size of .js files. The easiest way to address the problem of file size is to set the server to use zip compression. This compression will work far better than any whitespace parser and will reduce the size of all other source your server uploads. This method will work with or without semi-colons, but they should be used anyway for readability.
 
===Comments===