像这样使用垫片/填充物: https://github.com/es-shims/Object.entries
当您想在旧浏览器中使用更新的API时,通常要研究的第一个项目是是否存在简单的polyfill。而且,确实有一个非常简单的polyfill Object.entries() 显示在 MDN doc站点 :
Object.entries()
if (!Object.entries) Object.entries = function( obj ){ var ownProps = Object.keys( obj ), i = ownProps.length, resArray = new Array(i); // preallocate the Array while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]]; return resArray; };