update object in array if id exists else append javascript
By Margie White at Jul 13 2020
append new element for each value in array d3.js
By codeAdept at May 07 2020