jilingxf

爱前端公开课学习笔记——JS02 字符串类型,布尔类型

字符串是用引号包裹的,表示语言文字。

用双引号包裹的都是字符串

console.log(typeof 5);      // number
console.log(typeof "5");    // String

注意:变量不能包裹在双引号里

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        console.log(typeof 5);      // number
        console.log(typeof "5");    // String

        var a = 10;
        console.log("a");          //输出字母a

    </script>
</body>
</html>


输出

image


布尔类型

true和false

注意都是小写

console.log(4 > 3);
console.log(8 > 13);


image







posted on 2022-05-09 07:02  jilingxf  阅读(87)  评论(0编辑  收藏  举报

导航