jQuery proto 中的 Object(0) 是什么?

What is Object(0) in jQuery proto?

Object(0) 代表什么,为什么它是数组而不是对象?

jQuery returns 类数组对象。我猜它是 Object(0) 因为它基于常规 JavaScript Object.

根据您的结果,我假设您正在使用 JQUERY CALL例如 $("input"),return 是一个类似数组的对象。

要了解 _proto_ 是什么,您需要了解 prototypical inheritanceMDN Explanation

本质上,您继承的 root 对象是一个数组,这是因为您正在访问类似数组的 return 类型。explanation on why it is an array and not an object 几乎在页面底部。

来自第二个 mdn link

The proto getter function exposes the value of the internal [[Prototype]] of an object. For objects created using an object literal, this value is Object.prototype. For objects created using array literals, this value is Array.prototype. For functions, this value is Function.prototype. For objects created using new fun, where fun is one of the built-in constructor functions provided by JavaScript (Array, Boolean, Date, Number, Object, String, and so on —

如果还有人对Object(0)或[array-like]对象感到好奇

  • 出现Object(0)是因为prototype.length0
  • 出现Array-like是因为有prototype.splice

simple example of the phenomenon of Object(0) in proto