The second option is better in my book, since it is less redundant. Modern browsers and IDEs are pretty easy to find the error as you caused it.
Here's a jsFiddle that shows what is happening. Accidentally including a semicolon in a series raises an Uncaught ReferenceError
. This is a quick fix and a little compromise for a stronger syntax. If this is the worst mistake you have to deal with when writing JavaScript, you have a great day.
Ironically, in the second example, you had a typo - a semicolon after a
. Oops. :)
EDIT: Original poster with a fixed typo; I am leaving a mention because this is relevant to the original question.
source share