1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Document</title>
7
8 <script>
9 /*
10 if switch
11 prompt 给一个弹窗,可以输入,返回的结果就是用户在窗口上输入的值,以string类型返回
12 如果想转换成int类型,可以用Number.parseInt(变量名)
13 */
14
15 /*
16 var month = prompt("请输入月份")
17 var month = Number.parseInt(month)
18 if(month == 12 || month == 1 || month == 2){
19 console.log("冬季")
20 }else if(month == 3 || month == 4 || month == 5){
21 console.log("春季")
22 }else if(month == 6 || month == 7 || month == 8){
23 console.log("夏季")
24 }else if(month == 9 || month == 10 || month == 11){
25 console.log("秋季")
26 }else{
27 console.log("错误")
28 }
29 */
30
31 /*
32 1 非空字符串,会判断为true
33 2 非空对象,会判断为true
34 3 非0 number,会判断为true
35 */
36 if('false'){
37 console.log(true)
38 }else{
39 console.log(false)
40 }
41
42
43 </script>
44
45 </head>
46 <body>
47
48 </body>
49 </html>