12 ms·
I don't know about other languages but there are real practical reasons to choose 1TBS in Javascript, consider the following code: return { key: 'v
by davej 16y ago
I don't know about other languages but there are real practical reasons to choose 1TBS in Javascript, consider the following code:
return {
key: 'value',
anotherKey: 'another value'
}
This is fine and works as expected, now consider the following K&R/Allman style code...
return
{
key: 'value',
anotherKey: 'another value'
}
In Javascript this is parsed as `return;` (notice the semi-colon), this is because Javascript does its dreaded automatic semicolon insertion magic.
So, I think that's a pretty good practical reason to prefer 1TBS in Javascript.