News for hackers. Stuff that matters.
Re:Stranger Things, JavaScript Edition by waf on Thursday June 04, 2020 @01:12AM (#23412715)
Another fun one to figure out is:

  072 === 058 // returns true
Thankfully, doesn't work in strict mode.
Re:Stranger Things, JavaScript Edition by josefx on Thursday June 04, 2020 @02:23AM (#23413216)
If that is a combination of octal and decimal how is 058 not a parser error?
Re:Stranger Things, JavaScript Edition by tempodox on Thursday June 04, 2020 @02:37AM (#23413303)
`072` is interpreted as octal, and `058` is interpreted as decimal (7ยท8+2 = 58). Ah, the dumpster fire that is JavaScript.
Re:Stranger Things, JavaScript Edition by masswerk on Thursday June 04, 2020 @06:24AM (#23414780)
Prefixing octal numbers by zero was a common convention. The real dumpster fire was all those intermediate years without an octal notation in strict mode. (If you needed them, either forget strict mode, or choose between converting to meaningless decimals or using strings and feeding them through parseInt. What's sane about this?)

However, 058 should have been a parse error.

Re:Stranger Things, JavaScript Edition by tempodox on Saturday June 06, 2020 @09:00AM (#23438878)
I agree. That inconsistency in how the `0` prefix is handled shouldn't exist.