123456789101112131415161718192021222324252627282930313233 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <script>
- var a = true;
- // 变量未赋值,默认值为undefined
- // undefined 如果参与判断那么它代表的是 false
- // var b;
- // 如果数值型参与判断 那么0为假false 其他所有值均为真 ture
- // var c = 6;
- // 字符串参与判断 那么空字符串为假false 其他所有值均为真 ture
- // var d = "hello";
- // null 参与判断 那么它代表的是 false
- // var e = null;
- // if(e){
- // console.log("真")
- // }else{
- // console.log("假")
- // }
- // \n 换行 字符串中\开头的内容 表示转义字符
- console.log("hello\nworld");
- 'hello " world'
- // \" \' 转换成字符串进行输出 转义字符
- console.log("hello \" world")
- </script>
- </body>
- </html>
|