Files
2024-09-27 02:06:13 +08:00

44 lines
935 B
HTML

<!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>Function</title>
</head>
<body>
</body>
<script>
// Function 函数 方法 作用:实现代码的封装,降低代码冗余提高复用率
// 定义 function 方法名(方法参数1,方法参数2,.....) { // 你的代码 }
// 返回结果 返回值 return
// 匿名函数
// function xyf(money, action) {
// console.log("你的室友收到了你给的钱:", money);
// return "衣服洗完了,给你衣服"
// }
// 变量作用域
// 局部作用域
// 变量提升
var xyf = function () {
b = 2;
console.log("1: ",b);
}
xyf();
// var a = xyf(10, "我的衣服");
// console.log(a);
</script>
</html>