Object.prototype.toString.call()
来判断对象的数据类型
function isType(type, target) {
return `[object ${type}]` === Object.prototype.toString.call(target)
}
// 闭包版本
function isType(type) {
return function(target) {
return `[object ${type}]` === Object.prototype.toString.call(target)
}
}