| 12345678910111213141516171819202122232425262728 |
- <!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>
- let obj = {
- name: "张三",
- }
- function fn(x, y) {
- const sum = x + y;
- console.log(sum);
- console.log(this.name);
- console.log(this);
- }
- fn.bind(obj, 2, 3)()
- // fn.apply(obj, [2, 3])
- // fn.call(obj, 2, 3)
- </script>
- </body>
- </html>
|