Check that value is object literal?

后端 未结 12 696
逝去的感伤
逝去的感伤 2020-12-01 10:57

I have a value and want to know if it\'s an iteratable object literal, before I iterate it.

How do I do that?

12条回答
  •  借酒劲吻你
    2020-12-01 11:23

    You could also do something like:

        if (someObject.constructor == Object) {
            // do your thing
        }
    

    you can read more about it here

提交回复
热议问题