Conditionals

김민재·2021년 6월 30일
0

Gotcha JavaScript!

목록 보기
4/45

조건문

Type을 변경하는 방법
ParseInt()함수 사용

<script>
if(condition){
//  conditition === true
} else {
// condition === false
}
</script>
<script>
if(isNaN(age) || age < 0){
  console.log("plz write a real positive num")
} else if(age < 18) {
  console.log ("too young age")
} else if(age >= 18 && age <= 50) {
  console.log ("drink")
} else if (age > 50 && age <= 80) {
  console.log("stop drink")
}
else if (age > 80) {
  console.log("can't drink")
}
</script>

OR AND operate, && ||

= < <= === !===

profile
자기 신뢰의 힘을 믿고 실천하는 개발자가 되고자합니다.

0개의 댓글