How do I loop through or enumerate a JavaScript object?
You can use the for-in loop as shown by others. However, you also have to make sure that the key you get is an actual property of an object, and doesn’t come from the prototype. Here is the snippet: For-of with Object.keys() alternative: Notice the use of for-of instead of for-in, if not used it will return undefined on named … Read more