immutable js-->不可變得數據,或者不要修改的數據spa
基礎類型與引用類型:code
var a = {name:"will",things:[0,1,2]} var b = Object.assign({},a,{name:"Fred"}) //此時若是 b.things.push(3); //輸出 a.things//[0,1,2,3] //這是咱們不想獲得的結果.immutable的大體含義? //所以應該這樣作 b.things = a.things.concat(3); //此時輸出 a.things;//[0,1,2] b.things;//[0,1,2,3]
in order to keep data pristine and keep a full record of history as data changes;blog
爲了可以保證數據的原始性,跟蹤一系列的數據的變化記錄.table