I want to merge operators into one line of code if possible?
this.markers = [...new Map(this.markers.map(address => [Number(address.latitude), address])).values()]
this.markers = this.markers.filter(marker => marker.hasOwnProperty('pointId'))
This two line if i can to concate with one?
I would filter in advance and then get the mapped result.
this.markers = [...new Map(this.markers
.filter(marker => marker.hasOwnProperty('pointId'))
.map(address => [+address.latitude, address])
).values()];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.