Skip to content

Commit

Permalink
[javascript/en] Spacing and capitalization of comments
Browse files Browse the repository at this point in the history
... and a few grammar fixes.
  • Loading branch information
corbanmailloux committed Oct 28, 2015
1 parent 1893cc3 commit a8d5105
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions javascript.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ undefined; // used to indicate a value is not currently present (although
// character.
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;

// ...but your variable will be created in the global scope, not in the scope
Expand All @@ -145,7 +145,7 @@ someOtherVar = 10;
// Variables declared without being assigned to are set to 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
var someFourthVar = 2, someFifthVar = 4;

Expand Down Expand Up @@ -223,15 +223,15 @@ for (var i = 0; i < 5; i++){
// 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 person = {fname:"Paul", lname:"Ken", age:18};
for (var x in person){
description += person[x] + " ";
}

//If only want to consider properties attached to the object itself,
//and not its prototypes use hasOwnProperty() check
// To only consider properties attached to the object itself
// and not its prototypes, use the `hasOwnProperty()` check.
var description = "";
var person = {fname:"Paul", lname:"Ken", age:18};
for (var x in person){
Expand All @@ -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.
//There is no guarantee that for/in will return the indexes in any particular order
// For/in should not be used to iterate over an Array where the index 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
if (house.size == "big" && house.colour == "blue"){
Expand All @@ -256,7 +257,7 @@ var name = otherName || "default";


// 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.
grade = 'B';
switch (grade) {
Expand Down

0 comments on commit a8d5105

Please sign in to comment.