over 3 years ago

將值從一或多個來源物件複製到目標物件
範例

var first = { name: "Bob" };
var last = { lastName: "Smith" };

var person = Object.assign(first, last);
console.log(person);

// Output:
// { name: "Bob", lastName: "Smith" } 

var obj = { person: "Bob Smith"};
var clone = Object.assign({}, obj);

來源網址
https://msdn.microsoft.com/zh-tw/library/dn858229v=vs.94).aspx(

← Array.prototype.filter() 過濾器 React Redux 搭配 reselect 心得 →
 
comments powered by Disqus