[javascript/en] Spacing and capitalization of comments

... and a few grammar fixes.
This commit is contained in:
Corban Mailloux 2015-10-27 22:47:03 -04:00
parent 1893cc326c
commit a8d5105fab

View File

@ -136,7 +136,7 @@ undefined; // used to indicate a value is not currently present (although
// character. // character.
var someVar = 5; var someVar = 5;
// if you leave the var keyword off, you won't get an error... // If you leave the var keyword off, you won't get an error...
someOtherVar = 10; someOtherVar = 10;
// ...but your variable will be created in the global scope, not in the scope // ...but your variable will be created in the global scope, not in the scope
@ -145,7 +145,7 @@ someOtherVar = 10;
// Variables declared without being assigned to are set to undefined. // Variables declared without being assigned to are set to undefined.
var someThirdVar; // = undefined var someThirdVar; // = undefined
// if you want to declare a couple of variables, then you could use a comma // If you want to declare a couple of variables, then you could use a comma
// separator // separator
var someFourthVar = 2, someFifthVar = 4; var someFourthVar = 2, someFifthVar = 4;
@ -223,15 +223,15 @@ for (var i = 0; i < 5; i++){
// will run 5 times // will run 5 times
} }
//The For/In statement loops iterates over every property across the entire prototype chain // The for/in statement iterates over every property across the entire prototype chain.
var description = ""; var description = "";
var person = {fname:"Paul", lname:"Ken", age:18}; var person = {fname:"Paul", lname:"Ken", age:18};
for (var x in person){ for (var x in person){
description += person[x] + " "; description += person[x] + " ";
} }
//If only want to consider properties attached to the object itself, // To only consider properties attached to the object itself
//and not its prototypes use hasOwnProperty() check // and not its prototypes, use the `hasOwnProperty()` check.
var description = ""; var description = "";
var person = {fname:"Paul", lname:"Ken", age:18}; var person = {fname:"Paul", lname:"Ken", age:18};
for (var x in person){ for (var x in person){
@ -240,8 +240,9 @@ for (var x in person){
} }
} }
//for/in should not be used to iterate over an Array where the index order is important. // For/in should not be used to iterate over an Array where the index order
//There is no guarantee that for/in will return the indexes in any particular order // is important, as there is no guarantee that for/in will return the indexes
// in any particular order.
// && is logical and, || is logical or // && is logical and, || is logical or
if (house.size == "big" && house.colour == "blue"){ if (house.size == "big" && house.colour == "blue"){
@ -256,7 +257,7 @@ var name = otherName || "default";
// The `switch` statement checks for equality with `===`. // The `switch` statement checks for equality with `===`.
// use 'break' after each case // Use 'break' after each case
// or the cases after the correct one will be executed too. // or the cases after the correct one will be executed too.
grade = 'B'; grade = 'B';
switch (grade) { switch (grade) {