The for..of loop only supports iterable objects like arrays, not objects.
To iterate over the values of an object, use:
for (var key in test) {
var item = test[key];
}
More Related Contents:
- ECMAScript 2015: const in for loops
- Convert ES6 Iterable to Array
- Why should forEach be preferred over regular iterators?
- What is the technical definition of a Javascript iterable and how do you test for it?
- Javascript object bracket notation ({ Navigation } =) on left side of assign
- Elements order in a “for (… in …)” loop
- Pass options to ES6 module imports
- Is it spread “syntax” or the spread “operator”?
- addEventListener using for loop and passing values [duplicate]
- ES6: call class constructor without new keyword
- Arrow Functions and This [duplicate]
- Can you bind ‘this’ in an arrow function?
- ES2015 import doesn’t work (even at top-level) in Firefox
- Getting Unexpected Token Export
- Remove items from array with splice in for loop [duplicate]
- How can I access constants in the lib/constants.js file in Meteor?
- How to stop a JavaScript for loop?
- How to create an instance of a subclass from the super class?
- JavaScript ES6: Test for arrow function, built-in function, regular function?
- SyntaxError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’ – Gulp
- Property ‘entries’ does not exist on type ‘ObjectConstructor’
- How can I alias a default import in JavaScript?
- Unable to use Arrow functions inside React component class [duplicate]
- Not recommended to use “use strict” in ES6?
- Clean way to keep original variable and destructure at the same time
- Property change subscription with Aurelia
- How will browsers handle ES6 import/export syntax
- arrow function and this
- When would someone need to create a deferred?
- ES6 deep nested object destructuring