hoisting1 JS 2일차 1. if 조건문 if(조건) { 조건이 참일 경우 실행되는 코드 } else { 조건 외의 코드 } - if 조건문에서 조건이 boolean타입이 아닌 경우 조건이 nul, ' ', undefined 일 경우 false 조건이 !null이리 경우 null을 부정함으로서 true가 됨 2. switch 조건문 - 엄격 동등 연산(===)을 수행한다 var year = 2022; switch(year) { case 2021: console.log('작년'); break; case 2022: console.log('이번 년도'); break; case 2023: console.log('내년'); break; default: console.log('.'); } 3. 삼항연산자 - 조건 ? 값1 : 값2 - 조.. 2022. 12. 14. 이전 1 다음