在使用Object.fromEntries前使用以下方法:
if (!Object.fromEntries) {
Object.fromEntries = function (entries) {
if (!entries || !Array.isArray(entries)) {
throw new TypeError('Object.fromEntries requires an array-like object as argument.');
}
var result = {};
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
if (Array.isArray(entry) && entry.length === 2) {
result[entry[0]] = entry[1];
}
}
return result;
};
}