50 lines
1.0 KiB
HTML
50 lines
1.0 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Document</title>
|
||
|
<script>
|
||
|
var cat = {
|
||
|
name: "大喵",
|
||
|
run: function () {
|
||
|
console.log("我会跑")
|
||
|
},
|
||
|
eat() {
|
||
|
console.log("我在吃东西")
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var dog = {
|
||
|
name: "大汪",
|
||
|
bark() {
|
||
|
console.log("汪汪汪")
|
||
|
},
|
||
|
paqiang(m, n) {
|
||
|
console.log(this)
|
||
|
console.log(m, n, "我能爬墙")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// 大喵需要借用大汪的paqiang的技能
|
||
|
// dog.paqiang.call(cat,1,2)
|
||
|
dog.paqiang.apply(cat, [1, 2])
|
||
|
dog.paqiang()
|
||
|
|
||
|
function a(val) {
|
||
|
var name = val
|
||
|
c = 0
|
||
|
function b() { }
|
||
|
}
|
||
|
var str = 'Hello World'
|
||
|
a(1)
|
||
|
console.log(window.c)
|
||
|
</script>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|