https://school.programmers.co.kr/learn/courses/30/lessons/176963
function solution(name, yearning, photo) {
    let result = new Array(photo.length).fill(null);
    
    function makeObject(name, yearning){
        const obj = {};
        for(let i = 0; i < name.length; i++){
            obj[name[i]] = yearning[i];
        }
        return obj;
    }
    
    const checkPoint = makeObject(name, yearning);
    
    for(let i = 0; i < photo.length; i++){
        let tmpSum = 0;
        for(let j = 0; j < photo[i].length; j++){
            if(checkPoint[photo[i][j]] !== undefined){
                tmpSum += checkPoint[photo[i][j]];
            } else {
                tmpSum = tmpSum;
            }
        }
        result[i] = tmpSum;
    }
    return result;
}
function makeObject(name, yearning){ const obj = {}; for(let i = 0; i < name.length; i++){ obj[name[i]] = yearning[i]; } return obj; }우선 makeObject를 활용해 name, yearning을 obj에 넣어준다. 그러면 { may: 5, kein: 10, kain: 1, radi: 3 } 이렇게 결과값을 얻을 수 있다.
이후 photo의 배열에 추억 점수를 획득해야하는데, photo를 전부 돌려야하고, photo 내부에 또 배열이 있기 때문에 2중 for문으로 만들어준다. tmpSum임시 합을 선언 후, photo[i][j]값이 checkPoint안쪽에 있는 사람이라면 tmpSum에 더한다. 주의 사항으로 undefined를 확인해야지 없이 진행하면 tmpSum값이 null로 변환된다. 따라서 undefined를 신경써서 코드를 작성해야 한다.
