✏️7.9 알고리즘 교체하기 (Subsititue Algorithm)
function foundPerson(people){
for(let i = 0; < people.length; i++){
if (people[i] == "Don"){
return "Don";
}
if (people[i] == "Kent"){
return "Kent";
}
if (people[i] == "John"){
return "John";
}
}
return "";
}function foundPerson(people){
const candidates = ["Don", "John", "Kent"];
return people.find(p => candidates.includes(p)) || ;
}🧷 배경
🧷 절차
Last updated