You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Javascript has a feature called automatic semicolon insertion (ASI in short) that, as the name implies, will insert semicolons, this powers the optionality of semicolon when coding.
This behaviour can produce a change in the behaviour of the code, for example
functiontest(){return1}// => 1// vs functiontest(){return1}// => undefined
This is because the second function gets a semicolon which makes the code look like this
functiontest(){return;1;};
Difftastic currently outputs this as no changes, but this can be dangerous because the behaviour of the code changed.
The text was updated successfully, but these errors were encountered:
to add to this, needing to add semicolons, in general, slows down JS interpreters (the parser needs to find an error, backtrack and attempt to insert a semicolon to recover from the parse error, then it can continue)
i would recommend all semicolons show up in a diff, not just the ones that would change e.g. function results like the above
Javascript has a feature called automatic semicolon insertion (ASI in short) that, as the name implies, will insert semicolons, this powers the optionality of semicolon when coding.
This behaviour can produce a change in the behaviour of the code, for example
This is because the second function gets a semicolon which makes the code look like this
Difftastic currently outputs this as no changes, but this can be dangerous because the behaviour of the code changed.
The text was updated successfully, but these errors were encountered: