当前位置:网站首页>Principle of object. Prototype. ToString. Call()
Principle of object. Prototype. ToString. Call()
2022-07-28 22:05:00 【Big chicken legs are best】
let a={
a:1
}
let b=[2,3]
console.log(a.toString())
console.log(b.toString())
//[object Object], Output a Data type of
//2,3 Convert the values in the array into strings
js In fact, it rewrites some data types toString Method , That's why the above situation is created ,array Has its corresponding toString Method , Called nearby
let a={
a:1
}
let b=[2,3]
delete Array.prototype.toString
console.log(a.toString())
console.log(b.toString())
This will output [object Object] [object Array]
The elegant way is , Let the data of the variable you want to judge call Object.prototype.toString Methods , In this way, you can accurately judge the type of variables
边栏推荐
- Aimbetter insight into your database, DPM and APM solutions
- How does MySQL archive data?
- How many tips do you know about using mock technology to help improve test efficiency?
- 数据插值——对不同量级的数据进行归一化
- 第 7 篇:绘制旋转立方体
- No swagger, what do I use?
- PCB材料简单介绍
- I have been in the industry for 4 years and changed jobs twice. I have understood the field of software testing~
- Matlab|基础知识总结一
- 微信小程序开发公司你懂得选择吗?
猜你喜欢

Oracle database objects

kingbase中指定用户默认查找schema,或曰用户无法使用public schema下函数问题

Aimbetter insight into your database, DPM and APM solutions

Versailles ceiling: "the monthly salary of two years after graduation is only 35K, which is really unpromising ~ ~"

使用Mock技术帮助提升测试效率的小tips,你知道几个?

拥抱开源指南

How many tips do you know about using mock technology to help improve test efficiency?
![[NLP] generate word cloud](/img/c4/4e9707bba58732a90d1c30312719a3.png)
[NLP] generate word cloud

系统分析师

基于知识元的外文专利文献知识描述框架
随机推荐
Leetcode · 581. shortest unordered continuous subarray · double pointer
腾讯云数据库负责人借了一亿元炒股?知情人士:金额不实
Soft test --- database (3) data operation
HYDAC溢流阀DB08A-01-C-N-500V
I have been in the industry for 4 years and changed jobs twice. I have understood the field of software testing~
[machine learning] naive Bayesian classification of text -- Classification of people's names and countries
开放式耳机哪个音质好、公认音质好的气传导耳机推荐
Meeting notice of OA project (Query & whether to attend the meeting & feedback details)
搞事摸鱼一天有一天
Chinese patent keyword extraction based on LSTM and logistic regression
typeof原理
株洲市九方中学开展防溺水、消防安全教育培训活动
Cross domain transfer learning of professional skill word extraction in Chinese recruitment documents
Professional Committee of agricultural water and soil engineering of China Association of Agricultural Engineering - 12th session - Notes
开放式耳机哪个品牌好、性价比最高的开放式耳机排名
Pytoch learning record (III): random gradient descent, neural network and full connection
HCIA comprehensive experiment (take Huawei ENSP as an example)
Record some small requirements in the form of cases
Matlab|基础知识总结一
No swagger, what do I use?