Whats the best way to find out if an Object is an Array

后端 未结 4 1456
北荒
北荒 2021-02-13 21:07

As far as I know there are three ways of finding out if an object is an Array

by isArray function if implemented

Array.isArray()
         


        
4条回答
  •  [愿得一人]
    2021-02-13 22:04

    Unless it was proven that the former has significant performance benefits and my app required every last ounce of speed I would go for the latter.

    The reason is readability, pure and simple.

提交回复
热议问题