Search code examples
javascriptconsole

.pop() not working in browser cosole, why?


When I'm trying to console.log(this.pop()) in the browser console it's showing this error

Uncaught TypeError: this.pop is not a function at :1:6

Is there any way to make it working?

Hope you can help me


Solution

  • pop() is a method found in the Array.prototype and the globalThis is an object

    pop method can be called or applied to objects resembling arrays. Objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner.