判断是否为对象

一、判断是否为对象

  1.vue.js里面的方法

  function isObject (obj) {
    return obj !== null && typeof obj === 'object'
  }

  2.Object.prototype.toString()

  function isObject(obj){

    return Object.prototype.toString.call(obj)=='[object Object]'

  }

二、是对象判断是否为空对象(jquery里面的方法)

  function isEmptyObject(obj){

    for(var key in obj){

      return false;

    }

    return true;

  }

 

posted on 2018-06-25 17:19  myMaria  阅读(1829)  评论(0)    收藏  举报

导航