Ternary shortcut
I use ternary operators everywhere, but I saw someone use this short cut and my mind was blown:
(a ? a : b) => (a ?: b)
Maybe I’m way behind, but I thought it was a neat trick.
This is similar to what I miss a lot in most interpreted languages:
a || b
And while we’re on the subject, coffescript doesn’t support ternary, but you can mock it like this:
(a ? a - c : b) => (a && a - c || b)