How to judge the returned data type is the time to type it?

    var test1 = '你好'
    var test2 = new Date()
    function isDate(data) {
      return Object.prototype.toString.call(data)
    }
    isDate(test1)
    isDate(test2)
    var result = isDate(test2)
    if (result == '[object Date]') {
      console.log('I am date')
    }

Guess you like

Origin www.cnblogs.com/antyhouse/p/10931966.html