目录
javascript的函数function的建立
基本和C差不了多少
1.第一种
<!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>
function fun() {
console.log("123");
}
fun();
</script>
</body>
</html>
2.第二种
<script>
var fun = function () {
console.log("123");
};
fun();
</script>