| ▲ | jfengel a day ago | |
I occasionally run into problems with JS weird parsing rules. My favorite is:
Which does not return. It returns undefined.Typescript helps a lot with that. A linter will probably flag it as well. Still, JS went way out of its way to accept just about anything, whether it makes sense or not. | ||
| ▲ | galaxyLogic 21 hours ago | parent [-] | |
That is what I lament too. So I've started to use the comma-operator to make sure my return statements don't care about line-breaks. I often write: return 0, x; I find this a mildly amusing discovery for myself because it took me a long time to figure out a useful use for the comma-operator. | ||