Ok JavaScripter, I bet there's a really simple answer to this: Why is the return value of `eval('{foo:42}')` the number `42`, and the object `{foo:42}`?
-
-
{foo:42} is either an object literal or a block containing a label foo and a numeric literal
-
Yeah I found if I added `x = {...}` it worked. What threw me off first was that I initially tried `eval('{__proto__:{isAdmin: true}}')` but that’s basically just a more elaborate version of the one I ended up tweeting
- 1 more reply
New conversation -
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.