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