Javascript object forEach howto?
This question already has an answer here:
What you have here is a JavaScript question, not a TypeScript question. TS and JS have the same runtime semantics.
forEach
is a method of Array
. Objects don't have forEach
. The semantics of forEach
don't make sense on regular objects -- your obj
doesn't have a length
or a 0
property, for example, which are the kinds of things forEach
looks for.