JavaScript自学(2)

1、字符串类型详解

image-20210901195319211

image-20210901195751694

image-20210901195914596

image-20210901200059702

2、数组类型详解

image-20210901200424472

image-20210901200852681

image-20210901201026102

image-20210901201126225

image-20210901201244869

3、对象类型详解

image-20210901201805624

image-20210901202159802

image-20210901202438592

image-20210901202642944

4、分支和循环详解

image-20210901203338353

image-20210901204217966

image-20210901204304344

5、Map和Set集合

image-20210901205651936

image-20210901205732821

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script>
        \'use strict\';

        // console.log(\'a\nb\');
        // console.log("\u4e2d");

        //tab 上面esc键下面
        // var msg=`
        // hello
        // 你好
        // 我爱你
        // `

        // let name=\'caiwei\';
        // let age=4;
        // let msg=`你好呀,${name}`
        // console.log(msg)

        // var person={
        //     name:"caiwei",
        //     age:3,
        //     email:"caiwei@qq.com",
        //     score:0
        // }

        // var age=3;
        // if(age>3){
        //     alert(\'haha\');
        // }else{
        //     alert(\'kuwa~\')
        // }
        // while(age<100){
        //     age+=1;
        //     console.log(age)
        // }

        // for (let i = 0; i <100 ; i++) {
        //     console.log(i)
        // }

        // var age=[2,5,6,4,5,666,5];
        // age.forEach(function (value) {
        //     console.log(value);
        // })
        // for(var index in Object){}
        // for (var num in age) {
        //     console.log(age[num]);
        // }

        // var map=new Map([[\'tom\',100],[\'caiwei\',95],[\'jack\',50]]);
        // var score1=map.get(\'tom\');//通过key获得value
        // map.set(\'admin\',10);
        // console.log(score1);
        // map.delete(\'tom\');

        var set=new Set([3,1,1,1]);//set可以去重
        set.add(2);
        set.delete(1);
        console.log(set.has(3));
    </script>
</head>
<body>

</body>
</html>

版权声明:本文为gujiakai-top原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/gujiakai-top/p/15216400.html