2
xprnio
4y

What do you guys think about the comma expression in JavaScript? I'm aware that due to it's (to some) unknown nature that it can lead to subtle bugs, but I have at least one good use case for it and wanted to hear reasons why I shouldn't use it for similar use cases, but also what would be some other cool (not necessarily "good") use cases :D

Comments
  • 5
    I think that it's confusing, and arrow functions can usually do a better and more clear job.
  • 0
    As the other guy said it is confusing, but like 99% of JS is confusing so idk, it may be useful for some people but I think there are better and more readable ways to manage those comma cases
  • 3
    The fuck is the comma expression?
    I can't even imagine with the example provided.
  • 2
    I literally only use the comma operator in for loops when declaring multiple variables. Feel like it’s confusing to look at in any other context.
  • 1
    Splitting a one-liner to multiple lines with comments in between should be illegal. Is it common in webdev?
  • 1
    @electrineer i read up on it. As soon as you see the need to do it just don't do it.
  • 1
    Wtf why does my last comment contain a user tag.. sorry, that wasn't intended, must've been late.
  • 0
    I can't see how it could be confusing, it's clear and brilliant.
Add Comment