JSFiddle - React, Tailwind, and code Playground
JavaScript
let obj = {a: "John", b: "Sarah", c: "Lara", d: "Joseph", e: "Roger"}
let arr_of_keys = ["a", "d", "e", "f", "1"];
var result = arr_of_keys.reduce(function(o,item){
if(obj.hasOwnProperty(item)){
o[item] = obj[item];
}
return o;
}, {});
console.log(result)