์กฐ๊ฑด์ ๋ด์ฉ์ด ๋ฑ ๋จ์ด์ง๋ ํน์ ํ ๊ฐ์ผ ๊ฒฝ์ฐ ์ ์ฉ
switch (a) {
case 0 :
console.log('a is 0')
break
case 2 :
console.log('a is 2')
break
case 4 :
console.log('a is 4')
break
default :
console.log('rest...')
}
- break ๊ฐ ์์ผ๋ฉด ๊ณ์ ์คํ๋๊ธฐ ๋๋ฌธ์ ํ ์ผ์ด์ค๊ฐ ๋๋ ํ์๋ ์ฌ์ฉํด์ผ ํจ
- defalt ์์ ์กฐ๊ฑด์ด ๋ชจ๋ ์๋ ๊ฒฝ์ฐ ์คํ
๋ฐ์ํ
'๐ TIL' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[220418] JS data type (0) | 2022.04.18 |
---|---|
[220417] Data type / ๋ด์ฅ ๋ฉ์๋ (0) | 2022.04.18 |
[220412] grid (0) | 2022.04.13 |
[220412] ์คํ๋ฒ ์ค ์์ (0) | 2022.04.12 |
[220412] transition / transform / animation / @keyframs (0) | 2022.04.12 |