2020年5月31日

摘要: reduce() 方法对源数组的每个元素执行指定表达式。返回指定值 特性: 1、reduce()不会改变源数组 2、reduce()返回累加后的最终值 语法: arr.reduce(callback(accumulator,currentValue [, index [, array]])[, in 阅读全文
posted @ 2020-05-31 23:08 loongw 阅读(629) 评论(0) 推荐(0) 编辑
摘要: filter() 方法对源数组的每个元素判断。返回符合要求的元素,并将他们组成一个新的数组 特性: 1、filter()不会改变源数组 2、filter()返回新数组 语法: arr.filter(callback(currentValue [, index [, array]])[, thisAr 阅读全文
posted @ 2020-05-31 22:32 loongw 阅读(2127) 评论(0) 推荐(0) 编辑
摘要: map() 方法对数组的每个元素执行一次给定的函数。只对数组有效 特性: map()返回新数组 语法: arr.map(callback(currentValue [, index [, array]])[, thisArg]) 参数: arr.map有三个参数,分别是: 1、arr:被遍历的数组 阅读全文
posted @ 2020-05-31 22:12 loongw 阅读(3383) 评论(0) 推荐(0) 编辑
摘要: forEach() 方法对数组的每个元素执行一次给定的函数。只对数组有效 特性: forEach()本身不返回有意义的值,return会返回undefined 语法: arr.forEach(callback(currentValue [, index [, array]])[, thisArg]) 阅读全文
posted @ 2020-05-31 18:46 loongw 阅读(909) 评论(0) 推荐(0) 编辑
摘要: for...of语句在可迭代对象(包括 Array,Map,Set,String,TypedArray,arguments 对象等等)上创建一个迭代循环,调用自定义迭代钩子,并为每个不同属性的值执行语句 //给Object和Array对象的原型添加两个属性 Object.prototype.objC 阅读全文
posted @ 2020-05-31 18:23 loongw 阅读(594) 评论(0) 推荐(1) 编辑
摘要: for...in语句以任意顺序遍历一个对象的除Symbol以外的可枚举属性。 //给Object和Array对象的原型添加两个属性 Object.prototype.objCustom = function () { }; Array.prototype.arrCustom = function ( 阅读全文
posted @ 2020-05-31 17:35 loongw 阅读(657) 评论(0) 推荐(0) 编辑

2020年5月25日

摘要: 官话: Object.defineProperty() 方法会直接在一个对象上定义一个新属性,或者修改一个对象的现有属性,并返回此对象。 1、语法: Object.defineProperty(obj, prop, descriptor) 2、三个参数 obj要定义属性的对象。 prop要定义或修改 阅读全文
posted @ 2020-05-25 15:27 loongw 阅读(470) 评论(0) 推荐(0) 编辑

2020年5月24日

摘要: 一、使用原生ajax获取本地JSON文件中的数据 1)创建json数据文件,文件名:demo.json text.json内的数据代码如下: { "person":{"name":"tom","age":18} } 2)HTML文档中的代码如下: <!DOCTYPE html> <html lang 阅读全文
posted @ 2020-05-24 18:30 loongw 阅读(6625) 评论(0) 推荐(0) 编辑

2019年12月29日

摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2019-12-29 15:28 loongw 阅读(172) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2019-12-29 15:00 loongw 阅读(148) 评论(0) 推荐(0) 编辑

导航