samedi 21 novembre 2020

How to use conditional (ternary) operator with nested if statements?

I want to add more nested "if statements" in the succeeding lines but I don't know what to do while using ternary operator.

Object.freeze (phoneBook)

function lookup(name, address) {
  
for (let i = 0; i < phoneBook.length; i++) 

{

return (phonebook[i].givenName === name)? phoneBook[i][address]: "Not in the phonebook";
    
}

Aucun commentaire:

Enregistrer un commentaire