NOTE: javascript prototype chain

本文深入探讨了JavaScript中原型链的工作原理及其如何实现继承。通过一个简单的示例展示了对象如何从其原型继承属性,并且演示了当修改对象及其原型上的属性时会发生什么。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

=== copy from mastering dojo ===

What Is a Prototype?
Every object in JavaScript contains a reference to another
object termed its prototype. Since the prototype is another
object itself, it also contains a reference to its prototype. This
forms a chain of objects. The chain terminates with the prototype
for the built-in Object type.
When a property of an object is read, JavaScript looks for the
property in the object. If not found, JavaScript then looks in the
prototype object, the prototype of the prototype, and so on,
up the prototype chain until the property is found or the chain
is exhausted. Since a method is just a property that happens to
be a function, this is how method dispatching occurs, and this
system is called prototypal inheritance.

 

=== test ===

if (oSession.fullUrl.Contains("填写需要抓取的域名")) { var fso; var file; fso = new ActiveXObject("Scripting.FileSystemObject"); //文件保存路径,可自定义 file = fso.OpenTextFile("填写保存TXT文件地址",8 ,true, true); file.writeLine("Request url: " + oSession.url); file.writeLine("Request header:" + "\n" + oSession.oRequest.headers); file.writeLine("Request body: " + oSession.GetRequestBodyAsString()); file.writeLine("\n"); file.close(); }GET /api/im/messages/history?limit=20&chat_user_id=60c6905c000000000100a5c9&last_id=12&start_id=0 HTTP/1.1content={"content":"{\"title\":\"没去苏州!这里真的是广州!阴雨天真的好美\",\"image\":\"http://sns-img-al.xhscdn.com/1040g0083119lo4akma0048lunsumnadv45d7r5g?imageView2/2/w/360/format/jpg/q/75\",\"link\":\"xhsdiscover://item/66126b8b000000001a0118a6?app_platform=android&ignoreEngage=true&app_version=8.23.1&share_from_user_hidden=true&type=video&author_share=1&sourceId=message&feedType=single\",\"desc\":\"\",\"type\":\"note\",\"sourceTag\":\"\",\"noteType\":\"video\",\"user\":{\"id\":\"57c93d6ba9b2ed697085a9bf\",\"nickname\":\"He 琦琦\",\"image\":\"https://sns-avatar-qc.xhscdn.com/avatar/5c8f3f70540882000118c22b.jpg?imageView2/2/w/120/format/jpg\"},\"id\":\"66126b8b000000001a0118a6\",\"ts\":0,\"expression\":\"[{\\\"emoji\\\":\\\"[喝咖啡H]\\\",\\\"name\\\":\\\"已阅\\\"},{\\\"emoji\\\":\\\"[走起H]\\\",\\\"name\\\":\\\"走起\\\"},{\\\"emoji\\\":\\\"[派对R]\\\",\\\"name\\\":\\\"带我去\\\"}]\",\"cover\":\"http://sns-img-al.xhscdn.com/1040g0083119lo4akma0048lunsumnadv45d7r5g?imageView2/2/w/360/format/jpg/q/75\",\"minorPrice\":\"\",\"expectedPrice\":\"\",\"goodsImage\":\"\",\"goodsId\":\"\",\"itemTitle\":\"\",\"buttonLink\":\"\"}","content_type":3,"not_front_chain":false,"not_unread_count":false,"front_chain":"[笔记] 没去苏州!这里真的是广州!阴雨天真的好美"}
最新发布
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值