1. 程式人生 > >js處理資料的一些方法

js處理資料的一些方法

reduce

http://www.runoob.com/jsref/jsref-reduce.html


this.layerItems = this.layers.reduce((sum,l:Layer) => { sum.push({id: l.id , text: l.name }); return sum; }, []);

import { Subject } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
this.exp$ =new Subject<Experiment>(); this
.exp$.subscribe(exp=> this.exp= exp);
this.exp$.next(resas Experiment);
Object.assign() 
複製物件

JavaScript unshift() 方法

unshift() 方法可向陣列的開頭新增一個或更多元素,並返回新的長度。


regexp: values['regexp'] || ''

find方法

JSON.stringify