I have two arrays in javascript(Jquery 3.2). One array (source) has key-value pairs and other(target) has values only. I want to return those key-values from source which has matching values in other(target) array. Here are the arrays.
var source = [{ "a": 3 }, { "b": 2 }, { "c": 1 },{"k":12}];
var target = ["a", "b", "c","d"];
[{ "a": 3 }, { "b": 2 }, { "c": 1 }]perhaps? Also, what have you tried so far?