[javascript mode] Fix bug in handling of expressions without commas

Closes #1501