InterviewSolution
| 1. |
How ECMAScript is related to JavaScript? |
|
Answer» Library in JavaScript has a FUNCTION with a leading semicolon: ;(function ) { }Let us see the different uses of including a leading semicolon:
The purpose to include semicolon is to safely concatenate several JS files into one.
A leading semicolon protects from preceding code, which may have been improperly closed. A semicolon prevents this from occurring. If this is the case, then adding a semicolon will fix it.
The leading semicolon in immediately-invoked function expressions PREVENT errors when appending the file during CONCATENATION. This concat is to a file containing an expression improperly concluded with a semicolon Let’s see an example. Let’s SAY we are concatenating two files with self-invoking functions:
This helps in preventing any kind of errors when appending the file during concatenation. |
|