当前位置:网站首页>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]'
边栏推荐
- Short circuit operator lazy evaluation
- Design and manufacture of simple digital display electronic scale
- js作用域链与闭包
- Bird recognition app
- nacos簡易實現負載均衡
- Jetson Nano 安装TensorFlow GPU及问题解决
- Can diffusion models be regarded as an autoencoder?
- How to solve the problem of fixed assets management and inventory?
- phpexcel 里 获取某一列的列表 获取某一列的字母
- 队列的实现和应用
猜你喜欢

Error org apache. catalina. core. StandardContext. FilterStart start filter exception

Jetson Nano 安装TensorFlow GPU及问题解决
![2.3 [kaggle dataset - dog feed example] data preprocessing, rewriting dataset, dataloader reading data](/img/6e/d8ef618127ac492f5142f7b600266d.png)
2.3 [kaggle dataset - dog feed example] data preprocessing, rewriting dataset, dataloader reading data

Microcomputer principle - bus and its formation

Principle and application of single chip microcomputer timer, serial communication and interrupt system

Structure de l'arbre - - - arbre binaire 2 traversée non récursive

3D printing Arduino four axis aircraft

Nacos service configuration and persistence configuration

How to realize the usage of connecting multiple databases in idel

How to solve the problem of fixed assets management and inventory?
随机推荐
树结构---二叉树2非递归遍历
Daily office consumables management solution
LogBack
Yidian Yidong helps enterprises to efficiently manage equipment and improve equipment utilization
LeetCode 344. Reverse string
2.2 【pytorch】torchvision.transforms
【pytorch】softmax函数
An overview of the design of royalties and service fees of mainstream NFT market platforms
The jar package embedded with SQLite database is deployed by changing directories on the same machine, and the newly added database records are gone
MapReduce编程基础
js原型陷阱
Shell script - array definition and getting array elements
R language observation log (part24) -- initialization settings
Which method is good for the management of fixed assets of small and medium-sized enterprises?
2.4 激活函数
[pytorch learning] torch device
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
Leetcode daily question brushing record --540 A single element in an ordered array
Set the type of the input tag to number, and remove the up and down arrows
js this丢失问题分析 及 解决方案