Open axe-z opened 6 years ago
for (i in [1,2,3]) console.log(i)
seems to work just fine. Aren't variables that are declared without let/const implicitly let
s?
It's not a huge deal anyway, but the for IN is ok(var), regular for loop too :
for (var variable in object) { if (object.hasOwnProperty(variable)) {
} } && for (var i = 0; i < array.length; i++) { array[i] }
Might also be time to use the LET keyword ! I always, for no good reason mind you... , wake up and figure out the variable's missing after a few seconds of debugging.and YES, I've created my own snippet by now, but still, this should be an easy fix.
I've the same issue, for...of is creating code that produces ReferenceError. I think that a possible solution could be modify this file: https://github.com/atom/language-javascript/blob/master/snippets/language-javascript.cson
setting this line
'for of': 'prefix': 'forof' 'body': 'for (${1:variable} of ${2:iterable}) {\n\t$3\n}'
to this one (add var before the variable)
'for of': 'prefix': 'forof' 'body': 'for (var ${1:variable} of ${2:iterable}) {\n\t$3\n}'
left for vscode. Never thought I would. ( this was not the main reason of course )
Simple, latest version 1.30
for loop, the for of autocompletes (without any added snippets) this:
for (variable of iterable) {
}
always f...s me up later.
should be for (LET variable of iterable) {
}