当前位置:网站首页>Web APIs 高阶函数 丨黑马程序员
Web APIs 高阶函数 丨黑马程序员
2022-06-29 03:11:00 【黑马程序员官方】
高阶函数 可以被简单理解为函数的高级应用,JavaScript 中函数可以被当成【值】来对待,基于这个特性实现函数的高级应用。
【值】就是 JavaScript 中的数据,如数值、字符串、布尔、对象等。
学习路径:
1.1 函数表达式
函数表达式和普通函数并无本质上的区别: 
- 普通函数的声明与调用无顺序限制,推荐做法先声明再调用
- 函数表达式必须要先声明再调用
2.1 回调函数
- 如果将函数 A 做为参数传递给函数 B 时,我们称函数 A 为回调函数
- 简单理解: 当一个函数当做参数来传递给另外一个函数的时候,这个函数就是回调函数


本文章涉及到的代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let num = 10
//函数表达式
let fn = function () { }
btn.onclick = function () { }
// 高阶函数 函数的高级用法,把函数当值来看看
// 回调函数
// setInterval(function(){}, 1000)
function fn() { }
setInterval(fn, 1000)
// 此时 fn 就是回调函数 回头去调用的函数
box.addEventListener('click', fun)
function fun() {
}
</script>
</body>
</html>思考
- 函数也是【数据】
- 把函数赋值给变量
- 把函数当做另外一个函数的参数传递,这个函数就叫回调函数
- 回调函数本质还是函数,只不过把它当成参数使用
黑马前端专栏干货多多,关注再学,好方便~
2022年前端学习路线图:课程、源码、笔记,技术栈 另外此线路图实时更新!需要课后资料的友友们,可以直接告诉我。

边栏推荐
- Three methods of time series prediction: statistical model, machine learning and recurrent neural network
- [flutter topic] 66 diagram basic constraints box (I) yyds dry goods inventory
- 2022-2028 global long wave infrared camera and camera core industry research and trend analysis report
- Double click events and click events
- 2022-2028 global bubble CPAP system industry survey and trend analysis report
- Is it safe for qiniu school to open an account in 2022?
- Matlab exercises - image drawing exercises
- If you dare to write MQ message queue middleware on your resume, you must win these questions!
- Yyds dry inventory everything a primary developer should know about activity
- Lanbao sensor technology rushes to the scientific innovation board: annual revenue of 350million yuan xuyongtong family has a strong color
猜你喜欢

In depth analysis of Apache bookkeeper series: Part 3 - reading principle
![Jerry's watch begins to move [chapter]](/img/85/232da1c1f8dddb3af1e564e4a0fc53.jpg)
Jerry's watch begins to move [chapter]

What is a thread pool?

Analytic hierarchy process (AHP)

Yyds dry inventory difference between bazel and gradle tools

LinkedList学习

Problem - ADB shellerror: insufficient permissions for device: verify udev rules

Overview of PMP project management

LinkedList learning

18. ` BS object. Nom du noeud. Suivant Sibling ` get Brother Node
随机推荐
Jerry's watch obtains alarm mode settings [chapter]
Movement state change of monitoring device of Jerry's watch [chapter]
Codeforces Round #771 (Div. 2) ABC
[together with Shangshui Shuo series] day 6-strong liver academic paper! The most detailed explanation!
【一起上水硕系列】最简单的字幕配置
Jerry's watch begins to move [chapter]
Square root of X
Only in the past four years, Microsoft finally gave it up!
PWN beginner level0
Problème - Ajouter shellerror: permissions d'instrumentation pour le périphérique: vérifier les règles udev.
2022-2028 global bubble CPAP system industry survey and trend analysis report
If you dare to write MQ message queue middleware on your resume, you must win these questions!
[linear algebra] 1.1 second and third order determinants
Setting alarm mode of Jerry's watch [chapter]
手机开户股票开户安全吗?开户很难么?
[flutter topic] 66 diagram basic constraints box (I) yyds dry goods inventory
Informatics Olympiad 1361: Produce
Web GIS 航拍实现的智慧园区数字孪生应用
解决allegro中测量距离时,点击一个点后光标闪烁的问题
今日直播|Apache Pulsar x KubeSphere 在线 Meetup 火热来袭