Sjmarf@sh.itjust.works to Programmer Humor@programming.dev · 14 days agoJavaScriptsh.itjust.worksimagemessage-square48fedilinkarrow-up17arrow-down11
arrow-up16arrow-down1imageJavaScriptsh.itjust.worksSjmarf@sh.itjust.works to Programmer Humor@programming.dev · 14 days agomessage-square48fedilink
minus-squaredejected_warp_core@lemmy.worldlinkfedilinkarrow-up0·13 days agoI take this as less of a “I can’t use this intuitive feature reliably” thing and more of a “the truth table will bite you in the ass when you least expect it and/or make a mistake” thing.
minus-squareflying_sheep@lemmy.mllinkfedilinkarrow-up2·13 days agoJust use a formatter. It’ll show you that the second one is two statements: {} (the empty block) +[] coerce an empty array to a number: new Number(new Array())
I take this as less of a “I can’t use this intuitive feature reliably” thing and more of a “the truth table will bite you in the ass when you least expect it and/or make a mistake” thing.
Just use a formatter. It’ll show you that the second one is two statements:
{}
(the empty block)+[]
coerce an empty array to a number:new Number(new Array())