mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
[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>
This commit is contained in:
parent
0c3bde3ca7
commit
63a2c26029
@ -105,6 +105,10 @@ false;
|
|||||||
"1, 2, " + 3; // = "1, 2, 3"
|
"1, 2, " + 3; // = "1, 2, 3"
|
||||||
"Hello " + ["world", "!"]; // = "Hello world,!"
|
"Hello " + ["world", "!"]; // = "Hello world,!"
|
||||||
|
|
||||||
|
// ...which can result in some weird behaviour...
|
||||||
|
13 + !0; // 14
|
||||||
|
"13" + !0; // '13true'
|
||||||
|
|
||||||
// and are compared with < and >
|
// and are compared with < and >
|
||||||
"a" < "b"; // = true
|
"a" < "b"; // = true
|
||||||
|
|
||||||
@ -116,10 +120,6 @@ null == undefined; // = true
|
|||||||
"5" === 5; // = false
|
"5" === 5; // = false
|
||||||
null === undefined; // = 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`
|
// You can access characters in a string with `charAt`
|
||||||
"This is a string".charAt(0); // = 'T'
|
"This is a string".charAt(0); // = 'T'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user