Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

What is the difference between Array.function and Array.prototype.function?

I've found that some functions like concat() push() every() both exist in Array and Array.prototype(with firefox 57.0.1 console)

It's confusing since prototype methods exist in Array.
Additionally, where does staic method(Array.from(), Array.isArray() etc) exists in?

enter image description here


I think I've understood concepts of javascript prototype to some extent, so what I'm curious about is why prototype methods(concat() push() ...) apear both in Array and Array.prototype

Answer*

Draft saved
Draft discarded
Cancel
7
  • My firefox also shows Array.isArray with Object.getOwnPropertyName(Array) however does not show with just console.log(Array) How about you? Commented Dec 7, 2017 at 9:30
  • @soonoo Likewise, it doesn't appear in the console.log output, but it does appear in the object inspector pane. Perhaps it's a bug in the console? Commented Dec 7, 2017 at 9:37
  • Thanks but still confused ᅲᅲ Commented Dec 7, 2017 at 9:49
  • @soonoo what's the confusion? Commented Dec 7, 2017 at 9:55
  • it's not your answer, just about firefox's non-general behavior Commented Dec 7, 2017 at 10:01

lang-js

AltStyle によって変換されたページ (->オリジナル) /