判断一个函数是否为native code function isNative (Ctor) { return typeof Ctor === 'function' && /[native code]/.test(Ctor.toString())} typeof Promise !== 'undefined' && isNative(Promise)