D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
monkeycycle
Full window
Github gist
names matching
<script> var arrayOne = [{ "name": "Keny" }, { "name": "Sloane" }, { "name": "Elianna" }]; var arrayTwo = [{ "name": "Kenley" }, { "name": "Sloane" }, { "name": "Elianna" }]; var newArray = []; console.log("dogname: %o", arrayOne); console.log("peoplename: %o", arrayTwo); //loop through dog names for (var i = 0; i < arrayOne.length; i++) { console.log("dogname: %o", arrayOne[i]); // for each dog name, loop through human name for (var j = 0; j < arrayTwo.length; j++) { // if dog name equals a human name, add to new array if (arrayOne[i].name === arrayTwo[j].name) { console.log("Match: " + arrayOne[i].name + ' ' + arrayTwo[j].name); newArray.push(arrayOne[i].name); } } } console.log(newArray); </script>