Reasons to hate JavaScript #1098708976 let x = "a string" (x instanceof String) // returns false Because x isn't a String object yet. It's a literal. It only gets upgraded to an object when and if you call an object method/property on it, like x.trim() or x.length
-
-
Yes, that's the term, thank you! A primitive type (which can be defined as a literal or a variable), gets coerced to a matching object by the . operator. Looks like this is the closest the ES spec gets to saying so explicitly: https://www.ecma-international.org/ecma-262/6.0/#sec-getv …
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.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.