12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <script>
- // function foo(){
- // console.log("hello");
- // }
- // var foo = function(){
- // console.log("hello");
- // }
- // 箭头函数内部没有arguments
- // let foo = () => {
- // // console.log(arguments)
- // console.log("hello");
- // };
- // foo();
- var a = 10;
- // let obj = {
- // a : "hello",
- // foo:function(){
- // console.log(this.a)
- // }
- // }
- // 箭头函数内没有this
- let obj = {
- a : "hello",
- foo:()=>{
- console.log(this.a)
- }
- }
- obj.foo()
-
- </script>
- </body>
- </html>
|