<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
/*let say=function()
{
console.log("hello world");
}
say();
let fn=say;
fn();
// 将函数作为其他函数的参数
function test(fn) { // let fn = say;
fn();
}*/
function test()
{
let say=function()
{
console.log("牛逼");
}
return say;
}
let fn=test();
fn();
//这个可以解析为:
function test()
{
return function()
{
console.log("牛逼");
};
}
let fn=test();
fn();
//好了完成
</script>
</body>
</html>