草庐IT

【JavaScript】31_高阶函数(回调函数)

目前我们的函数只能过滤出数组中age属性小于18的对象,我们希望过滤更加灵活:比如:过滤数组中age大于18的对象age大于60的对象age大于n的对象过滤数组中name为xxx的对象过滤数组中的偶数...一个函数的参数也可以是函数,如果将函数作为参数传递,那么我们就称这个函数为回调函数(callback)classPerson{constructor(name,age){this.name=name;this.age=age}}constpersonArr=[newPerson('孙悟空',180),newPerson('沙和尚',36),newPerson('红孩儿',5),newPers

【JavaScript】31_高阶函数(回调函数)

目前我们的函数只能过滤出数组中age属性小于18的对象,我们希望过滤更加灵活:比如:过滤数组中age大于18的对象age大于60的对象age大于n的对象过滤数组中name为xxx的对象过滤数组中的偶数...一个函数的参数也可以是函数,如果将函数作为参数传递,那么我们就称这个函数为回调函数(callback)classPerson{constructor(name,age){this.name=name;this.age=age}}constpersonArr=[newPerson('孙悟空',180),newPerson('沙和尚',36),newPerson('红孩儿',5),newPers