当前位置:网站首页>JS use toString to distinguish between object and array
JS use toString to distinguish between object and array
2022-07-01 09:18:00 【su27_ 0101】
typeof confound with
typeof yes js Provided Used to determine the type of variable Reserved words
But for judgment Object And Array Will return to Object
That is to say, I can't distinguish
typeof [ ];//Object
typeof {};//Object
toString To distinguish between
utilize Object.prototype.toString The printed string distinguishes
Object.prototype.toString.call([]);//'[object Array]'
Object.prototype.toString.call({});//'[object Object]'
Other types can also be distinguished
Object.prototype.toString.call(arguemnts);//'[object Arrguments]'
边栏推荐
- 2.3 [kaggle dataset - dog feed example] data preprocessing, rewriting dataset, dataloader reading data
- 2.4 激活函数
- Summary of reptile knowledge points
- Leetcode daily question brushing record --540 A single element in an ordered array
- Principles of Microcomputer - internal and external structure of microprocessor
- Niuke monthly race 22- collect pieces of paper
- 【pytorch】softmax函数
- laravel postman 提交表单出现419错误。2020年7月6日记。
- Football and basketball game score live broadcast platform source code /app development and construction project
- Structure de l'arbre - - - arbre binaire 2 traversée non récursive
猜你喜欢

Microcomputer principle - bus and its formation

Vsync+ triple cache mechanism +choreographer

JS原型链

队列的实现和应用

【pytorch】nn.CrossEntropyLoss() 与 nn.NLLLoss()

FAQ | FAQ for building applications for large screen devices

An overview of the design of royalties and service fees of mainstream NFT market platforms

ESP8266 FreeRTOS开发环境搭建
![[interview brush 101] linked list](/img/52/d159bc66c0dbc44c1282a96cf6b2fd.png)
[interview brush 101] linked list

Preparing for the Blue Bridge Cup -- bit operation
随机推荐
Implementation and application of queue
Microcomputer principle - bus and its formation
OSPF - virtual link details (including configuration commands)
Principles of Microcomputer - internal and external structure of microprocessor
Can diffusion models be regarded as an autoencoder?
Youqitong PE toolbox [vip] v3.7.2022.0106 official January 22 Edition
js this丢失问题分析 及 解决方案
序列化、监听、自定义注解
2.3 【kaggle数据集 - dog breed 举例】数据预处理、重写Dataset、DataLoader读取数据
闭包实现迭代器效果
Pain points and solutions of equipment management in large factories
nacos简易实现负载均衡
Databinding source code analysis
樹結構---二叉樹2非遞歸遍曆
The fixed assets management system enables enterprises to dynamically master assets
Imitation of Baidu search results top navigation bar effect
Shell script - definition, assignment and deletion of variables
ES6-const本质与完全不可改实现(Object.freeze)
Tree structure -- binary tree 2 non recursive traversal
js函数arguments对象