Context: I had an isAlpha function and I was passing in indexes from a string, but my index overflowed the string and so returned undefined
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
This is a great reason to use a type-checked version of JS (Flow or TypeScript): it renders an entire class of errors like this impossible.pic.twitter.com/EUL9GTbeLZ
-
See my follow up tweet with more context. TypeScript and Flow don’t require bounds checks for indexes.
End of conversation
New conversation -
-
-
One of the most underrated
#wtfjs -
Go step further /[A-Za-z]/.test(void 0) === true
End of conversation
New conversation -
-
-
Interesting /[A-Za-z]/.test([]) === false /[A-Za-z]/.test({}) === true as the string conversion of an empty object contains chars ('[object Object]') /[A-Za-z]/.test(NaN) === true // is also quite amusing
- 1 more reply
New conversation -
-
-
Jajajajajajaja vascript
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Bitten by this before as well
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 