js if문 중첩 없애기
//원본 function test() { let result = ''; if (a) { if(!b) { result = 'c'; } } else { result = 'a'; } result += 'b'; return result; } //줄인 코드 function test() { let result = ''; if (!a) { result = 'a'; result += 'b'; return result; } if(!b) { result = 'c'; } result += 'b'; return result; } // 1. if문 다음에 나오는 중복된 절차를 찾아 if문 안에 넣는다. // 2. 짧은 단계를 위로 올린다. // 3. 위로 올린 짧은 단계 마지막에 return. // 4. 뒤에있는 else를 지운다.