1、判断一个变量未定义的方法:
export const isUndefined = (val)=> {
return val === void 0;
};
export const isUndefined = (val)=> {
return Object.prototype.toString.call(undefined) === '[object Undefined]';
};
2、判断一个变量已定义的方法:
export const isDefined = (val) => {
return val !== undefined && val !== null;
};