Hie All,
I have two arrays as below:
var arr1 = [ '1956888670', '2109171907', '298845084' ];
var arr2 = [
{ KEY: '1262875245', VALUE: 'Vijay Kumar Verma' },
{ KEY: '1956888670', VALUE: 'Sivakesava Nallam' },
{ KEY: '2109171907', VALUE: 'udm analyst' },
{ KEY: '298845084', VALUE: 'Mukesh Nagora' },
{ KEY: '2007285563', VALUE: 'Yang Liu' },
{ KEY: '1976156380', VALUE: 'Imtiaz Zafar' },
];
arr1 has keys and arr2 has key and value. i want to output key and value of only those keys which are present in arr1. Hence my output should be,
[{ KEY: '1956888670', VALUE: 'Sivakesava Nallam' },
{ KEY: '2109171907', VALUE: 'udm analyst' },
{ KEY: '298845084', VALUE: 'Mukesh Nagora' },]
Requesting your help to write a function to fetch required output using javascript.Thanks in advance.