摘要: ###JS Map和Set <script> 'use strict' /*Map,可重复*/ var map = new Map([['tom', 100], ['小明', 99], ['小红', 98]]);//参数是一个数组 var name = map.get('tom');//通过key去 阅读全文
posted @ 2022-05-02 16:23 小幼虫虫 阅读(94) 评论(0) 推荐(0)
摘要: ###JS 分支和循环 <script> 'use strict' /*if判断*/ var age = 3; if (age > 3) {//第一判断 alert("大于3") } else if (age < 5) {//第二判断 alert("小于5") } else { //否则 alert 阅读全文
posted @ 2022-05-02 16:22 小幼虫虫 阅读(26) 评论(0) 推荐(0)
摘要: ###JS 数组 <script> 'use strict'; var arr = [1, 2, 3, 4, 5, "1"]; var array = [1, 2, 3, 4, 5, "1"]; console.log(arr); /*数组长度,可变化,赋值过大,增加空值;赋值过小,会丢失元素*/ 阅读全文
posted @ 2022-05-02 16:21 小幼虫虫 阅读(31) 评论(0) 推荐(0)
摘要: ###JS对象 <script> /*javaScript中,所有键都是字符串,值是任意对象!*/ /*创建对象*/ var person = { name: "zhangSan", age: 3, high: 175 }; console.log(person.high) /*动态删除属性*/ d 阅读全文
posted @ 2022-05-02 16:21 小幼虫虫 阅读(25) 评论(0) 推荐(0)