Skip to content

Instantly share code, notes, and snippets.

@moonrailgun
Created July 20, 2017 06:13
Show Gist options
  • Save moonrailgun/c39b7e5eae080e35161b504818a2864d to your computer and use it in GitHub Desktop.
Save moonrailgun/c39b7e5eae080e35161b504818a2864d to your computer and use it in GitHub Desktop.
IE兼容性处理
// Object.assign for IE11
if(!Object.assign) {
Object.assign = function(target) {
'use strict';
if(target == null) {
throw new TypeError('Cannot convert undefined or null to object');
}
target = Object(target);
for(var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if(source != null) {
for (var key in source) {
if (source.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment