It makes refactoring easier because each declaration is completely independent from the other ones. Just remove a line to remove a variable. You don't even need to change a comma to a semicolon.
Another advantage: Most search tools only show the line where the search string occurs. If you search for all occurences of bar in your editor, you might prefer to see
constbar=20;
instead of
bar=20,
as a result because it provides more information.
I don't believe that typing a few more keywords will slow down your coding significantly.
Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
I definitely prefer
not only for
const
but also forvar
andlet
.It makes refactoring easier because each declaration is completely independent from the other ones. Just remove a line to remove a variable. You don't even need to change a comma to a semicolon.
Another advantage: Most search tools only show the line where the search string occurs. If you search for all occurences of
bar
in your editor, you might prefer to seeinstead of
as a result because it provides more information.
I don't believe that typing a few more keywords will slow down your coding significantly.
Clearer search results is an interesting point I hadn't heard before. 🤔 Nice one, I'll have to think on that