-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semicolons in JavaScript #18
Comments
hey, thanks for asking! I just prefer it, and think it boils down to personal style. here are some random thoughts: I dont keep them out for byte size reasons, byte size of source code syntax/style isn't really important since minifies will take everything out anyway. I do it because I havent found them to be necessary myself I'm not sure what cases people get caught by not using semicolons, but it doesnt happen to me so I am happy not using them The two cases I know to avoid are:
which gets interpreted as but I avoid it by not using anonymous inline functions and writing it like this instead:
which accomplishes the same thing but doesnt use the IIFE pattern which I think is ugly anyway the second case is:
which gets interpreted as
|
thanks for your answer! |
Sorry to jump into a closed thread, but I've been working through thoughts on life without semicolons and came up with an additional solution to an IIFE after var x = y
void function (){ }() 👍 |
What about: var x = y
!function(){}() |
var x = y
void function (){ }() This is actually straightforward! |
other ones :P ~function (){ }()
+function (){ }()
-function (){ }() |
you guys this is clearly the best and most readable way var x = y
typeof function (){ }() |
This one is obviously the most performant: var x = y
delete function () {} () |
And now I win: var x = y
new function(){} Look ma, no call! |
as much as I enjoy bad humor I am gonna hit my gmail space limit if this keeps goin |
Just wondering, why don't you use Semicolons in JavaScript? Isn't it safer - and only costs a few extra bytes? (Not trying to start a flamewar, just interested in your take on it)
The text was updated successfully, but these errors were encountered: