tfm@europe.pub to Programmer Humor@programming.devEnglish · 1 year agoTrue crimeeurope.pubimagemessage-square69linkfedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageTrue crimeeurope.pubtfm@europe.pub to Programmer Humor@programming.devEnglish · 1 year agomessage-square69linkfedilink
minus-squareLemminary@lemmy.worldlinkfedilinkarrow-up0·1 year ago Explanation for nerds The reason is the JS compiler removes whitespace and introduces semicolons only “where necessary”. So writing function myFn() { return true; } Is not the same as function myFn() { return true; } Because the compiler will see that and make it: function myFn() { return; true; } You big ol’ nerd. Tee-hee.
minus-squareEphera@lemmy.mllinkfedilinkEnglisharrow-up0·1 year agoThat’s terrifying, especially in JS where no type system will fuck you up for returning nothing when you should’ve returned a boolean.
Explanation for nerds
The reason is the JS compiler removes whitespace and introduces semicolons only “where necessary”.
So writing
Is not the same as
Because the compiler will see that and make it:
You big ol’ nerd. Tee-hee.
That’s terrifying, especially in JS where no type system will fuck you up for returning nothing when you should’ve returned a boolean.
Common JavaScript L