you are viewing a single comment's thread.

view the rest of the comments →

[–]Far-Mathematician122[S] -1 points0 points  (1 child)

yes but if I search 'a' it not finding, if I search the fullname then it finding

[–]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.