This will give us two alerts. The first will have 13 in it and the second will have 42. This is yet another thing I've learned in reading Kyle Simpson's "this & OBJECT PROTOTYPES" ...
var foo = {
bar: 13
};
var baz = {
qux: 42
};
var whatever = Object.assign({},foo,baz);
alert(whatever.bar);
alert(whatever.qux);
Addendum 7/17/2015: There may be any number of values handed in. (well, any number two or greater) The first value in is the target and all of the values after it get appended to it.
No comments:
Post a Comment