[javascript mode] Another fix to parsing for-loop specs

Issue #1418