Question
When displaying data in the interface using a for loop after making a data request in JavaScript, it keeps prompting that:
e.forEach is not a function.Copy codeCopy code
Answer
The data requested using http.createHttp() is a JSON string, and forEach cannot be used on strings. You can use JSON.parse() to convert the string into a JSON object, and then use the forEach function.
Top comments (0)