Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript:compare two arrays and returns match

function select(arr, obj) {
  const result = {};
  for (let name of arr) {
    if (name in obj) {
      result[name] = obj[name];
    }
  }
  return result;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #arrays #returns #match
ADD COMMENT
Topic
Name
8+5 =