05 if...else语句
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
var distance = 10;
var nowDistance = 5;
if (nowDistance<distance) {
console.log('自动驾驶')
} else{
console.log('人为驾驶')
}
var weather = 'rainy';
if (weather === 'sunny') {
console.log('天气非常棒')
}
else if (weather === 'rainy') {
console.log('天气下雨了')
}
else if (weather === 'snowing') {
console.log('天气下雪了')
}
else{
alert('输入天气有错')
}
</script>
</body>
</html>