摘要: 数组:一组数据(一个变量来承载) var str = "Hello world"; // 一个变量存放一个数据 var arr = [1,2,3,4,5,6,7,8,9]; //往数组结尾插入元素 arr[arr.length] = 20 数组有两种定义方式 var arr = []; //字面量的 阅读全文
posted @ 2020-04-09 14:11 strongerPian 阅读(122) 评论(0) 推荐(1) 编辑
摘要: 面向对象 类 定义属性和方法 对象 类的具体实现,继承了类所定义的属性和方法(是一种数据类型) 类是对象的抽象,对象是类的实例 js中的对象? js语言中一切皆为对象,比如数字、字符串、数组、Math、Object、函数 js中对象的本质:属性和方法的集合(无序,所以对象没有length属性) 用官 阅读全文
posted @ 2020-04-09 13:36 strongerPian 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 匿名函数:没有名字的函数 function () { console.log(123) } var test = function () { console.log(123) } div.onclick = function () { console.log(123) } 自调用函数(IIFE) I 阅读全文
posted @ 2020-04-09 13:32 strongerPian 阅读(144) 评论(0) 推荐(0) 编辑
返回顶端