From 0e1677b6c9d0ec6fe86783d9b700a6d1b38c32dd Mon Sep 17 00:00:00 2001 From: Markus Amalthea Magnuson Date: Tue, 16 Apr 2013 11:20:23 +0200 Subject: [PATCH 1/4] Just whitespace. --- page/javascript-101/operators.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/page/javascript-101/operators.md b/page/javascript-101/operators.md index d9186c8a..b0c4f67f 100644 --- a/page/javascript-101/operators.md +++ b/page/javascript-101/operators.md @@ -5,6 +5,7 @@ source: http://jqfundamentals.com/legacy attribution: - jQuery Fundamentals --- + Basic operators allow you to manipulate values. ``` @@ -125,4 +126,5 @@ foo > bim; // false bim > baz; // true foo <= baz; // true ``` + For more information about comparison operators, visit the [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comparison_Operators "MDN - Comparison Operators"). From 371b68bb7401f33f7bd4185d70003f4a60f6d4bd Mon Sep 17 00:00:00 2001 From: Markus Amalthea Magnuson Date: Tue, 16 Apr 2013 11:20:52 +0200 Subject: [PATCH 2/4] Sentencize code comments. --- page/javascript-101/operators.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/page/javascript-101/operators.md b/page/javascript-101/operators.md index b0c4f67f..b27bc92b 100644 --- a/page/javascript-101/operators.md +++ b/page/javascript-101/operators.md @@ -17,13 +17,13 @@ console.log( foo + " " + bar ); // "hello world" ``` ``` -// Multiplication and division +// Multiplication and division. 2 * 3; 2 / 3; ``` ``` -// Incrementing and decrementing +// Incrementing and decrementing. // The pre-increment operator increments the operand before any further processing. var i = 1; console.log( ++i ); // 2 - because i was incremented before evaluation @@ -48,7 +48,7 @@ console.log( foo + bar ); // 12 ``` ``` -// Coercing a string to act as a number: +// Coercing a string to act as a number. var foo = 1; var bar = "2"; @@ -58,7 +58,7 @@ console.log( foo + Number(bar) ); // 3 The Number constructor, when called as a function (as in the above example), will have the effect of casting its argument into a number. The unary plus operator also does the same thing: ``` -// Forcing a string to act as a number (using the unary plus operator): +// Forcing a string to act as a number (using the unary plus operator). console.log( foo + +bar ); // 3 ``` @@ -67,7 +67,8 @@ console.log( foo + +bar ); // 3 Logical operators allow evaluation of a series of operands using AND ( `&&` ) and OR ( `||` ) operations. ``` -// Logical AND and OR operators +// Logical AND and OR operators. + var foo = 1; var bar = 0; var baz = 2; @@ -93,10 +94,10 @@ In the above example, the `||` operator returns the value of the first truthy op You'll sometimes see developers use these logical operators for flow control instead of using `if` statements. For example: ``` -// do something with foo if foo is truthy +// Do something with foo if foo is truthy. foo && doSomething( foo ); -// set bar to baz if baz is truthy; +// Set bar to baz if baz is truthy; // otherwise, set it to the return value of createBar() var bar = baz || createBar(); ``` @@ -108,7 +109,8 @@ This style is quite elegant and pleasantly terse; that said, it can be really ha Comparison operators allow you to test whether values are equivalent or whether values are identical. ``` -// Comparison operators +// Comparison operators. + var foo = 1; var bar = 0; var baz = "1"; From 83e82230f9479ed968dfe83c0bfeeab012752656 Mon Sep 17 00:00:00 2001 From: Markus Amalthea Magnuson Date: Tue, 16 Apr 2013 11:21:09 +0200 Subject: [PATCH 3/4] Number -> `Number` --- page/javascript-101/operators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/page/javascript-101/operators.md b/page/javascript-101/operators.md index b27bc92b..27827940 100644 --- a/page/javascript-101/operators.md +++ b/page/javascript-101/operators.md @@ -55,7 +55,7 @@ var bar = "2"; console.log( foo + Number(bar) ); // 3 ``` -The Number constructor, when called as a function (as in the above example), will have the effect of casting its argument into a number. The unary plus operator also does the same thing: +The `Number` constructor, when called as a function (as in the above example), will have the effect of casting its argument into a number. The unary plus operator also does the same thing: ``` // Forcing a string to act as a number (using the unary plus operator). From 93b224518f812cdd9e18a2b95ca0269e43728c27 Mon Sep 17 00:00:00 2001 From: Markus Amalthea Magnuson Date: Tue, 16 Apr 2013 11:21:23 +0200 Subject: [PATCH 4/4] No space inside body text parentheses. --- page/javascript-101/operators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/page/javascript-101/operators.md b/page/javascript-101/operators.md index 27827940..6ab577cb 100644 --- a/page/javascript-101/operators.md +++ b/page/javascript-101/operators.md @@ -64,7 +64,7 @@ console.log( foo + +bar ); // 3 ## Logical Operators -Logical operators allow evaluation of a series of operands using AND ( `&&` ) and OR ( `||` ) operations. +Logical operators allow evaluation of a series of operands using AND (`&&`) and OR (`||`) operations. ``` // Logical AND and OR operators.