JSFiddle - React, Tailwind, and code Playground

by Bhabani Raju

HTML

<pre id="data"></pre>

JavaScript

var customers = [{
  CustomerName: 'Customer1',
},
{
  CustomerName: 'Customer2',
}];

// array 2

var locations= [{
  CustomerName: 'Customer1',
  latitude: 555555
},
{
  CustomerName: 'Customer2',
  latitude: 666666
},
{
  CustomerName: 'Customer3',
  latitude: 777777
}];

for(var i = 0; i < locations.length; i++){
	for(var j = 0; j < customers.length; j++){
  	if(locations[i].CustomerName == customers[j].CustomerName){
    	 customers[j].latitude = locations[i].latitude
     }
  }
}
console.log(JSON.stringify(customers,null,4))
document.getElementById("data").innerHTML = JSON.stringify(customers,null,4)