回答編集履歴
2
コードの修正
answer
CHANGED
@@ -15,7 +15,6 @@
|
|
15
15
|
});
|
16
16
|
return target;
|
17
17
|
}
|
18
|
-
Object.prototype.assign = newAssign;
|
19
18
|
|
20
19
|
const defaultOptions = {
|
21
20
|
a: true,
|
@@ -40,7 +39,7 @@
|
|
40
39
|
}
|
41
40
|
}
|
42
41
|
};
|
43
|
-
const options =
|
42
|
+
const options = newAssign(defaultOptions, yourOptions);
|
44
43
|
console.log(options);
|
45
44
|
```
|
46
45
|
とりあえず、いろいろ情報を整理してこんな感じのコードで自分のやりたいことはできました。
|
1
関数名ミス
answer
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
6
6
|
const value = descriptor.value;
|
7
7
|
if (typeof value == "object") {
|
8
|
-
|
8
|
+
newAssign(target[key], value);
|
9
9
|
} else {
|
10
10
|
descriptors[key] = descriptor;
|
11
11
|
}
|