JavaScript single line ‘if’ statement – best syntax, this alternative?
I’ve seen the short-circuiting behaviour of the && operator used to achieve this, although people who are not accustomed to this may find it hard to read or even call it an anti-pattern: Personally, I’ll often use single-line if without brackets, like this: If I need to add more statements in, I’ll put the statements on the next line … Read more