Skip to content

Commit 1843a3b

Browse files
committed
Object.assign multiple mixins
1 parent 6e650af commit 1843a3b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

JavaScript/3-assign.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ const mix1 = {
1717
}
1818
};
1919

20-
Object.assign(obj1, mix1);
20+
const mix2 = {
21+
toString() {
22+
return `${this.name} - ${this.city} - ${this.born}`;
23+
}
24+
};
25+
26+
Object.assign(obj1, mix1, mix2);
2127
console.log(obj1);
2228
console.log(obj1.toString());
2329
console.log(`His age is ${obj1.age()} as of today`);

0 commit comments

Comments
 (0)