[js] look ahead for conflicting var names in blocks because that's how scoping works there (closes #3344)