728x90
반응형
자바스크립트에도 if문이 있다. (JAVA와 동일한 구조를 갖고 있음)
<script>
let a = 10;
if (a === 7) {
console.log('hi');
} else if (a === 8) {
console.log('hi2');
} else if (a % 10 === 0) {
console.log('hi3');
} else {
console.log('hi4');
}
</script>
728x90
반응형
'Javascript' 카테고리의 다른 글
[JS] 문자열 다루기 (0) | 2023.06.11 |
---|---|
[JS] 반복문 (0) | 2023.06.11 |
[JS] 연산자 (0) | 2023.06.11 |
[JS] 데이터 타입 (0) | 2023.06.11 |
[JS] 변수 (0) | 2023.06.11 |