Skip to content
Akin C edited this page Apr 15, 2018 · 12 revisions

Welcome to the Javascript-semicolon-third-rule- wiki!

This repository is part of a larger project!

◀️ PREVIOUS PROJECT| NEXT 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:

  1. 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++));

Content

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.

ERROR: No image found!

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.

Clone this wiki locally