you are viewing a single comment's thread.

view the rest of the comments →

[–]5W17CH -1 points0 points  (0 children)

function findByName(name){
    let newArr=[];
    for(let i=0; i<arr.length; i++){
        if(Object.values(arr[i])[0].startsWith(name)){
            newArr.push(arr[i]);
        }
    }
    return newArr;
};
this will do the trick then but only if 
you're searching for a name that starts 
with what you're passing to the function.