프로그래머스 위장
해당 정보를 hash안에 넣어준다
value값들에 1을 더하고 곱해준다(곱해줘야해서 1을 default로!)
function solution(clothes) {
let hash={};
let answer=1;
for(let i=0; i<clothes.length; ++i){
if(!hash[clothes[i][1]]){
hash[clothes[i][1]]=1
}else{
hash[clothes[i][1]]+=1
}
}
for(let i of Object.keys(hash)){
answer *= (hash[i]+1)
}
return answer-1
}