I am writing a telemetry function in my code. I am using the Performance.getEntriesByType() function mentioned at the MDN link here - https://developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType. As per the link it mentions that the method returns a list of PerformanceEntry objects / empty list. However, when I invoke the "forEach" method on the returned value of the window.performance.getEntriesByType(type) method, I get the following error
TypeError: Object [object Object] has no method 'forEach'
Couple of doubts:
- Why do I get the error 'forEach' has no method?
- What does Object [object Object] in the error message imply?