summaryrefslogtreecommitdiffhomepage
path: root/javascript.html.markdown
diff options
context:
space:
mode:
authorChris Harding <sjrct@users.noreply.github.com>2023-08-25 03:54:23 +0000
committerGitHub <noreply@github.com>2023-08-25 11:54:23 +0800
commit63a2c260297e7e00ccd2c893b341db45e3d53a71 (patch)
tree4c78f725e882e88ae2b76c304d72033db30f6179 /javascript.html.markdown
parent0c3bde3ca73e9bb0801f4d835b841775724aade5 (diff)
[javascript/en] Reorder block (#4706)
It makes more sense here, as in the type coercion on addition is what leads to the weird behavoir. Co-authored-by: Chris Harding <christopher.harding@galvanize.com>
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r--javascript.html.markdown8
1 files changed, 4 insertions, 4 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown
index 41ed7dea..cb530bbb 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -105,6 +105,10 @@ false;
"1, 2, " + 3; // = "1, 2, 3"
"Hello " + ["world", "!"]; // = "Hello world,!"
+// ...which can result in some weird behaviour...
+13 + !0; // 14
+"13" + !0; // '13true'
+
// and are compared with < and >
"a" < "b"; // = true
@@ -116,10 +120,6 @@ null == undefined; // = true
"5" === 5; // = false
null === undefined; // = false
-// ...which can result in some weird behaviour...
-13 + !0; // 14
-"13" + !0; // '13true'
-
// You can access characters in a string with `charAt`
"This is a string".charAt(0); // = 'T'