当前位置:网站首页>JS prototype chain
JS prototype chain
2022-04-23 09:05:00 【A blog】
Prototype chain learning
1、 IE11 And Google __proto__ Change of direction
// Change direction __proto__ The direction of
var obj1={
a:1,
b:2
}
var obj2=Object.create(obj1)// Appoint obj2 The prototype object of is obj1
console.log(obj1.__proto__)// The prototype chain points to Object.prototype
console.log(obj2.__proto__)// The prototype chain points to obj1
2、 compatible ie11 Let's point to the problem
// compatible ie11 Let's point to the problem ( My own ie)
//ie Prototype mechanism , But there is no prototype chain
var obj1={
a:1,
b:2
}
var obj2=Object.create(obj1)// Appoint obj2 The prototype object of is obj1
console.log(obj1.__proto__)// The prototype chain points to Object.prototype
console.log(obj2.__proto__)// The prototype chain points to obj1
3、 Delete __proto__ Point to
// Delete
//null: Release object
var obj1={a:1,b:2}
obj1.__proto__=null
console.log(obj1.toString())
4、 Use of custom methods in prototypes
// Capitalize the first letter
String.prototype.shuozimudaxie=function(){
return this[0].toUpperCase()+this.slice(1)
}
var str="akjkjkjkjkjkjkjkjk".shuozimudaxie();
console.log(str);
版权声明
本文为[A blog]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230901327262.html
边栏推荐
- L2-024 部落 (25 分)(并查集)
- Notes d'apprentissage oneflow: de functor à opexprinterpreter
- Chris LATTNER, father of llvm: the golden age of compilers
- MYCAT configuration
- Enterprise wechat application authorization / silent login
- node安装
- OneFlow學習筆記:從Functor到OpExprInterpreter
- 1099 建立二叉搜索树 (30 分)
- 机器学习(六)——贝叶斯分类器
- RSA 加密解密签名验签
猜你喜欢

npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’

Star Trek's strong attack opens the dream linkage between metacosmic virtual reality

Brush classic topics

Harbor enterprise image management system

2021李宏毅机器学习之Adaptive Learning Rate

OneFlow学习笔记:从Functor到OpExprInterpreter
![[C language] document operation](/img/89/b19dda13d27e37fedf6736c102245b.png)
[C language] document operation

The crawler returns null when parsing with XPath. The reason why the crawler cannot get the corresponding element and the solution

ATSS(CVPR2020)

node安装
随机推荐
Download and install bashdb
Flink reads MySQL and PgSQL at the same time, and the program will get stuck without logs
Cadence process angle simulation, Monte Carlo simulation, PSRR
Data visualization: use Excel to make radar chart
BK3633 规格书
Production practice elk
Multi view depth estimation by fusing single view depth probability with multi view geometry
爬虫使用xpath解析时返回为空,获取不到相应的元素的原因和解决办法
L2-023 图着色问题 (25 分)(图的遍历)
Whether the same binary search tree (25 points)
On array replication
Withholding agent
Thread scheduling (priority)
单片机数码管秒表
Complete binary search tree (30 points)
LLVM之父Chris Lattner:编译器的黄金时代
Talent Plan 学习营初体验:交流+坚持 开源协作课程学习的不二路径
LeetCode_ DFS_ Medium_ 1254. Count the number of closed islands
K210 learning notes (II) serial communication between k210 and stm32
[in-depth good article] detailed explanation of Flink SQL streaming batch integration technology (I)