This is not a duplicate of Merging/Joining GeoJSON and JSON? because I need to join on client side.
I want to develop a choropleth map. I am using the same tutorial of Leaflet. I am also using the same statesData provided in that tutorial. The problem is value. I am getting an API which providing me the value of states. The 2nd JSON is providing me the id of states and its corresponding value. I want to visualize the choropleth map using these instead of Density value given in the statesData.js file.
How can I put this value to obtain a choropleth map instead of using density that showed in the tutorial?