呼叫大神!js中Array打印出的属性和方法,请解释下是如何分类的,有什么作用,谢谢

weixin_41363109 2018-03-27 11:11:30
ƒ Array()
arguments:(...)
caller:(...)
from:ƒ from()
isArray:ƒ isArray()
length:1
name:"Array"
of:ƒ of()
prototype:[constructor: ƒ, concat: ƒ, find: ƒ, findIndex: ƒ, pop: ƒ, …]
Symbol(Symbol.species):(...)
get Symbol(Symbol.species):ƒ [Symbol.species]()
__proto__:ƒ ()[[Scopes]]:Scopes[0]

console.log(Array);
打印出的属性列表,请解释下prototype、__proto__和剩下其他属性的区别
另外添加属性的时候,使用Array.index = 1、Array.prototype.index = 1、Array.__proto__.index=1的区别

...全文
428 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
似梦飞花 2018-03-27
  • 打赏
  • 举报
回复
吧Array看作一个类 Array.index = 1 类的静态属性 Array.prototype.index = 1 类的实例属性 所有new的对象共享 Array.__proto__.index=1 >>Array.constructor.prototype.index=1 Array.constructor==Function 所有function是Function的实例 所以 function f(){} f.index==1

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧