-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This repository is part of a larger project!
This project contains the second rule of semicolons in Javascript. The other ones are found here:
Javascript inserts in some circumstances internally semicolons, but according to third rule:
- No automatically insertion of semicolons as seperators in the head of a for loop
For example:
//Parse error
for(var i = 0 i < 2 i++)
{
/*Do something*/
}
There is an issue here which is the lack of knowledge from my side, why exactly the seperation in a for loop is made with semicolons! If you at any rate know some explanation or better a valid source, please post it under the section Issues in this github project!Thank you very much!
Another example is the while loop specificially found in the file "rule.js":
//No parse error even without a body, but will not work without a semicolon
while(split(i++));
The user interaction part, after using the default input value, could look like the content as seen below by starting "index.html" in a web browser.
The string splitting is realized with a bodiless while loop as seen in the second example.
The colored areas are just for a better readability in the wiki and are not part of the content. To use the project just download the files and execute "index.html". Note that all files should be placed in the same folder so that the functionality of the code is guaranteed.
This knowledge was gained:
Effective JavaScript "68 Specific Ways to Harness the Power of JavaScript" by David Herman