Commit 07395e5
Fix '1' + 2n BigInt example on Addition page (mdn#43812)
* Fix '1' + 2n BigInt example on Addition page
The 'Addition using BigInts' example marked "1" + 2n as throwing a
TypeError, but the + operator checks for a string operand before the
BigInt/Number mix check, so "1" + 2n performs string concatenation
and returns "12". Remove the incorrect line and add a short clarifying
section with the real behavior.
Fixes mdn#43807
* Update index.md
---------
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>1 parent 2b6ef41 commit 07395e5
File tree
1 file changed
+7
-2
lines changed- files/en-us/web/javascript/reference/operators/addition
1 file changed
+7
-2
lines changedLines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
0 commit comments