JS
大数据时代_yang
这个作者很懒,什么都没留下…
展开
-
JS继承的应用案例
1、原型链继承子类的原型指向父类的实例,这就是原型链的指向方式。function Parent () { this.name = 'haha';}Parent.prototype.getName = function () { console.log(this.name);}function Child () {}Child.prototype = new Parent();var child1 = new Child();console.log(chil原创 2021-05-12 10:57:21 · 467 阅读 · 0 评论 -
js Array相关方法
1.join()将数组中的元素按指定的元素拼接起来2.toString()将数组转为字符串,(将元素用,拼接起来)3.添加元素 push("尾部添加") shift(“头部添加”)4.删除元素 pop("尾部删除") unShift("头部删除");5.reverse()将数组元素倒置 sort()将数组元素从小到大进行排列6.concat(),数组合并并返回新的数组7.splice(),可以删除数组中指定的元素,可以向指定元素位置添加元素(array1.splice(0,0,"开始","开始2原创 2021-05-10 15:10:11 · 122 阅读 · 0 评论