Why can't I use a variable in same function scope in Javascript?

đź‘Ť:-1

In the loop try data[i].value instead. Data is an array in your code, but you try to reference as though it has a property it just doesn’t because it’s an array of objects. You’ll also want i < data.length or you’ll get more exceptions.

There is actually quite a bit more wrong than I initially saw, as the string literal is odd, though this may be a paste error?

Leave a comment