随笔分类 -  JavaScript

reduce()累加器
摘要:reduce() 方法对源数组的每个元素执行指定表达式。返回指定值 特性: 1、reduce()不会改变源数组 2、reduce()返回累加后的最终值 语法: arr.reduce(callback(accumulator,currentValue [, index [, array]])[, in 阅读全文

posted @ 2020-05-31 23:08 loongw 阅读(652) 评论(0) 推荐(0)

filter()数组遍历
摘要:filter() 方法对源数组的每个元素判断。返回符合要求的元素,并将他们组成一个新的数组 特性: 1、filter()不会改变源数组 2、filter()返回新数组 语法: arr.filter(callback(currentValue [, index [, array]])[, thisAr 阅读全文

posted @ 2020-05-31 22:32 loongw 阅读(2187) 评论(0) 推荐(0)

map()数组遍历
摘要:map() 方法对数组的每个元素执行一次给定的函数。只对数组有效 特性: map()返回新数组 语法: arr.map(callback(currentValue [, index [, array]])[, thisArg]) 参数: arr.map有三个参数,分别是: 1、arr:被遍历的数组 阅读全文

posted @ 2020-05-31 22:12 loongw 阅读(3428) 评论(0) 推荐(0)

forEach()数组遍历
摘要:forEach() 方法对数组的每个元素执行一次给定的函数。只对数组有效 特性: forEach()本身不返回有意义的值,return会返回undefined 语法: arr.forEach(callback(currentValue [, index [, array]])[, thisArg]) 阅读全文

posted @ 2020-05-31 18:46 loongw 阅读(930) 评论(0) 推荐(0)

for...of数组遍历
摘要:for...of语句在可迭代对象(包括 Array,Map,Set,String,TypedArray,arguments 对象等等)上创建一个迭代循环,调用自定义迭代钩子,并为每个不同属性的值执行语句 //给Object和Array对象的原型添加两个属性 Object.prototype.objC 阅读全文

posted @ 2020-05-31 18:23 loongw 阅读(625) 评论(0) 推荐(1)

for...in对象遍历
摘要:for...in语句以任意顺序遍历一个对象的除Symbol以外的可枚举属性。 //给Object和Array对象的原型添加两个属性 Object.prototype.objCustom = function () { }; Array.prototype.arrCustom = function ( 阅读全文

posted @ 2020-05-31 17:35 loongw 阅读(676) 评论(0) 推荐(0)

Object.defineProperty(obj,prop,{descriptor})
摘要:官话: Object.defineProperty() 方法会直接在一个对象上定义一个新属性,或者修改一个对象的现有属性,并返回此对象。 1、语法: Object.defineProperty(obj, prop, descriptor) 2、三个参数 obj要定义属性的对象。 prop要定义或修改 阅读全文

posted @ 2020-05-25 15:27 loongw 阅读(502) 评论(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:28 loongw 阅读(181) 评论(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 阅读(164) 评论(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 14:59 loongw 阅读(140) 评论(0) 推荐(0)

Event对象跨浏览器兼容性写法
摘要:<!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 13:31 loongw 阅读(386) 评论(0) 推荐(0)

IE8中的Event对象属性与方法
摘要:<!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-28 20:05 loongw 阅读(512) 评论(0) 推荐(0)

Event对象属性与方法
摘要:<!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-28 19:39 loongw 阅读(1167) 评论(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-28 19:35 loongw 阅读(151) 评论(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-28 19:33 loongw 阅读(125) 评论(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-28 19:31 loongw 阅读(164) 评论(0) 推荐(0)

IE事件流
摘要:<!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-28 19:30 loongw 阅读(178) 评论(0) 推荐(0)

事件解绑removeEventListener
摘要:<!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-28 19:28 loongw 阅读(477) 评论(0) 推荐(0)

DOM2级事件addEventListener
摘要:<!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-28 19:25 loongw 阅读(228) 评论(0) 推荐(0)

拆分文本节点splitText()
摘要:<!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-28 19:24 loongw 阅读(644) 评论(0) 推荐(0)

导航