声明式的可以先调用,在定义
赋值式必须先定义在调用
<!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>
<!-- 1.定义函数 声明式 -->
<script>
test1()
function test1(){
console.log(" 声明式test1")
}
function test2(){
console.log("声明式test1")
}
// 2.调用函数
test1()
test2()
// 2.(1)定义函数 赋值式
var test3 = function(){
console.log("赋值式test3")
}
// (2)调用函数
test3()
</script>
</body>
</html>