03 補充.html
阿新 • • 發佈:2021-11-18
<!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>
<script>
// typeof
// instanceof
var arr=[1,2,3,4,5];
console.log(typeof arr);// 返回 object
console.log(typeof {});// 返回 object
console.log(arr instanceof Array); // 返回 true
console.log({} instanceof Object); // 返回 true
console.log(arr instanceof Object); // 返回 true
// call apply // bind 返回型別(函式)的拷貝 // console.log(Object.prototype.toString.call(arr)) // console.log(Object.prototype.toString.bind(arr)())
// 高階函式 // function f (){ // console.log("f()") // } // f()
// 函式裡面套函式 // function f (){ // return function(){ // console.log("f()") // } // } // f()() // console.log("f()")
// function f(fun,fun2){ // btn.click = function (){ // fun() // fun2() // } // }
// function sum(){ // console.log("sum") // }
// 回撥地獄(套娃) // function f(fun){ // fun(); // } // f(f(f(f()))) // Promise then
// sum(); // f(sum)
</script> </head> <body> </body> </html>
// call apply // bind 返回型別(函式)的拷貝 // console.log(Object.prototype.toString.call(arr)) // console.log(Object.prototype.toString.bind(arr)())
// 高階函式 // function f (){ // console.log("f()") // } // f()
// 函式裡面套函式 // function f (){ // return function(){ // console.log("f()") // } // } // f()() // console.log("f()")
// function f(fun,fun2){ // btn.click = function (){ // fun() // fun2() // } // }
// function sum(){ // console.log("sum") // }
// 回撥地獄(套娃) // function f(fun){ // fun(); // } // f(f(f(f()))) // Promise then
// sum(); // f(sum)
</script> </head> <body> </body> </html>