函数式编程——判断类型 发表于 2018-05-24 12345678910111213// 返回一个判断类型的函数function isType(Type) { return function (val) { return Object.prototype.toString.call(val) === `[object ${Type}]` }}isFunction = isType('Function');isString = isType('String');isDate = isType('Date');isNumber = isType('Number'); // NaN 也是numberisObject = isType('Object');isUndefine = isType('Undefined');isNull = isType('Null')