[Solved] I have returned two values but console displaying only one value.. what’s wrong with my code?


use array find https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find

var contacts = 
    [ { firstname: 'karthi'
      , lastname:  'kosuri'
      , mobile:    '9999666888889'
      , likes:     [ 'pizza', 'icecream', 'curdrice' ] 
      } 
    , { firstname: 'sathvik'
      , lastname:  'kosuri'
      , mobile:    '9849488486'
      , likes:     [ 'biryani', 'vada', 'idly' ] 
      } 
    , { firstname: 'neelu'
      , lastname:  'kosuri'
      , mobile:    '892736636'
      , likes:     [ 'annam', 'pappu', 'charu'] 
      } 
    , { firstname: 'kesav'
      , lastname:  'kosuri'
      , mobile:    '748484848484'
      , likes:     [ 'kudithi', 'sambar', 'bokka'] 
      } 
    ];

function contactlookup(name, prop)
{
  let lookup = contacts.find(elm=>elm.firstname===name && elm.lastname===prop )
  return (lookup)? lookup : 'no such name' 
}


var data = contactlookup('karthi', 'kosuri')

console.log(data); 
.as-console-wrapper { max-height: 100% !important; top: 0; }

solved I have returned two values but console displaying only one value.. what’s wrong with my code?