1、如何判断数组?

(1)instanceof

不能使用typeof判断数组。

 

 (2)constructor

(3)Object.prototype.toString.call()

 

 (4)Array.isArray()

 2、如何进行数组去重?

(1)使用栈方法

 

 (2)new Set方法

 

 (3)indexOf() + lastIndexOf()方法

 

(4)排序+循环

(5)includes方法

 

 3、如何进行数组降维?

(1)flat()方法

 

 (2)利用栈的方法

 

 (3)toString方法

 

(4)递归调用

 

posted on 2021-05-25 16:37  李起桉  阅读(41)  评论(0编辑  收藏  举报