aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects
diff options
context:
space:
mode:
authornanshu <56244178+LuckyChou710@users.noreply.github.com>2022-03-11 01:50:17 +0800
committerGitHub <noreply@github.com>2022-03-11 01:50:17 +0800
commit0016c74a9255332c793969dd194d5c4809e7f452 (patch)
tree36bd9f909fb183c97ca0eff265ffa2e4336a7d9b /files/zh-cn/web/javascript/reference/global_objects
parent38052b3e991be5cf0f0c6bfed80d969a73aa7816 (diff)
downloadtranslated-content-0016c74a9255332c793969dd194d5c4809e7f452.tar.gz
translated-content-0016c74a9255332c793969dd194d5c4809e7f452.tar.bz2
translated-content-0016c74a9255332c793969dd194d5c4809e7f452.zip
remove Object.assign polyfill (#4392)
There are two polyfills
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html33
1 files changed, 0 insertions, 33 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html b/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html
index 4b8696d2ab..616406e3e5 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/object/assign/index.html
@@ -251,39 +251,6 @@ console.log(copy);
// { foo:1, get bar() { return 2 } }
</pre>
-<h2 id="Polyfill">Polyfill</h2>
-
-<p>此{{Glossary("Polyfill","polyfill")}}不支持 symbol 属性,因为ES5 中根本没有 symbol :</p>
-
-<pre class="brush: js">if (typeof Object.assign != 'function') {
- // Must be writable: true, enumerable: false, configurable: true
- Object.defineProperty(Object, "assign", {
- value: function assign(target, varArgs) { // .length of function is 2
- 'use strict';
- if (target == null) { // TypeError if undefined or null
- throw new TypeError('Cannot convert undefined or null to object');
- }
-
- let to = Object(target);
-
- for (var index = 1; index &lt; arguments.length; index++) {
- var nextSource = arguments[index];
-
- if (nextSource != null) { // Skip over if undefined or null
- for (let nextKey in nextSource) {
- // Avoid bugs when hasOwnProperty is shadowed
- if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
- to[nextKey] = nextSource[nextKey];
- }
- }
- }
- }
- return to;
- },
- writable: true,
- configurable: true
- });
-}</pre>
<h2 id="Specifications">规范</h2>