summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Brenecki <adam@brenecki.id.au>2015-10-28 13:18:37 +1030
committerAdam Brenecki <adam@brenecki.id.au>2015-10-28 13:18:37 +1030
commit9d2efe69d0bd1c29dcb5dd32283caf1b6723d23d (patch)
treed6242946a5405cfbe28f919dddba6cb24cea7e98
parent1893cc326c01205d2b619278d5fb9869775df9e1 (diff)
parenta8d5105fab5e40923d834fb5848aabf561bc1701 (diff)
Merge pull request #1837 from corbanmailloux/patch-2
[javascript/en] Spacing and capitalization of comments
-rw-r--r--javascript.html.markdown17
1 files changed, 9 insertions, 8 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown
index b54434e0..5bac3aa7 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -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
@@ -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;
@@ -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){
@@ -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"){
@@ -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) {