240103

๋ฌธ์ œ : ๊ฐ๋„๊ธฐ ๋‚œ์ด๋„ : Lv.0 ์„ค๋ช… :

๊ฐ์—์„œ 0๋„ ์ดˆ๊ณผ 90๋„ ๋ฏธ๋งŒ์€ ์˜ˆ๊ฐ, 90๋„๋Š” ์ง๊ฐ, 90๋„ ์ดˆ๊ณผ 180๋„ ๋ฏธ๋งŒ์€ ๋‘”๊ฐ 180๋„๋Š” ํ‰๊ฐ์œผ๋กœ ๋ถ„๋ฅ˜ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ angle์ด ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ ์˜ˆ๊ฐ์ผ ๋•Œ 1, ์ง๊ฐ์ผ ๋•Œ 2, ๋‘”๊ฐ์ผ ๋•Œ 3, ํ‰๊ฐ์ผ ๋•Œ 4๋ฅผ returnํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”.

๋‚ด ํ’€์ด

function solution(angle) {
    let answer
    
   if (0 < angle && angle < 90) {
       answer = 1;
    
   } else if (angle === 90) {
       answer = 2;
      
   } else if(90 < angle && angle < 180) {
    answer = 3

   } else if(angle === 180){
    answer = 4

}
    return answer
}

๐Ÿ‘€ ๋‹ค๋ฅธ ์‚ฌ๋žŒ ํ’€์ด

function solution(angle) {
    return [0, 90, 91, 180].filter(x => angle>=x).length;
}
function solution(angle) {
    return angle < 90 ? 1 : angle === 90 ? 2 : angle < 180 ? 3 : 4;
}

Last updated