当前位置:网站首页>JS topic - console log()
JS topic - console log()
2022-07-05 15:20:00 【Shepherd Wolf】
1. function 、 Variable Scope
(1)
Foo()
function Foo () {
console.log(this.getName())
}
var getName = function () {
console.log(4)
}
Foo()
function getName () {
console.log(5)
}
Foo()
(2)
Foo()
function Foo () {
getName = function () {
console.log(1)
}
console.log(this.getName())
}
var getName = function () {
console.log(4)
}
Foo()
function getName () {
console.log(5)
}
Foo()(3)
function Foo () {
getName = function () {
console.log(1)
}
return this
}
Foo.getName = function () {
console.log(2)
}
new Foo.getName()(4)
function Foo () {
getName = function () {
console.log(1)
}
return this
}
Foo.getName = function () {
console.log(2)
}
Foo.prototype.getName = function () {
console.log(3)
}
var getName = function () {
console.log(4)
}
function getName () {
console.log(5)
}
Foo.getName()
getName()
Foo().getName()
getName()
new Foo.getName()
new Foo().getName()
new new Foo().getName()(5)
function test() {
console.log(1, this)
return function() {
console.log(2, this)
return function () {
console.log(3, this)
}
};
};
document.querySelector("input").addEventListener('input', test()());(6)
for (var i = 0; i <10; i++) {
setTimeout(function() {
console.log(i);
}, 0);
}
for (let i = 0; i <10; i++) {
setTimeout(function() {
console.log(i);
}, 0);
}【 answer 】:
1.
(1) 5 4 4
(2) 1 1 1
(3) 2
(4) 2 4 1 1 2 3 3
(5) Page initialization this-> window window. (input After entering the value this-> input)
(6) 10 individual 10; 0 1 2 3 4 5 6 7 8 9
边栏推荐
- Hongmeng system -- Analysis from the perspective of business
- 爱可可AI前沿推介(7.5)
- CPU design related notes
- I spring web upload
- Coding devsecops helps financial enterprises run out of digital acceleration
- Bugku's steganography
- Thymeleaf uses background custom tool classes to process text
- easyOCR 字符识别
- Redis distributed lock principle and its implementation with PHP (1)
- Crud de MySQL
猜你喜欢

P1451 求细胞数量/1329:【例8.2】细胞

Machine learning notes - gray wolf optimization

SQL Server learning notes

当代人的水焦虑:好水究竟在哪里?

爱可可AI前沿推介(7.5)

Ctfshow web entry command execution

Mongdb learning notes

做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史

机器学习笔记 - 灰狼优化

Coding devsecops helps financial enterprises run out of digital acceleration
随机推荐
Common interview questions about swoole
Handwriting promise and async await
mapper.xml文件中的注释
MongDB学习笔记
ICML 2022 | 探索语言模型的最佳架构和训练方法
GPS原始坐标转百度地图坐标(纯C代码)
Leetcode: Shortest Word Distance II
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
Redis distributed lock principle and its implementation with PHP (1)
No one consults when doing research and does not communicate with students. UNC assistant professor has a two-year history of teaching struggle
【jvm】运算指令
Stm32+bh1750 photosensitive sensor obtains light intensity
[detailed explanation of Huawei machine test] happy weekend
CPU design practice - Chapter 4 practical task 2 using blocking technology to solve conflicts caused by related problems
Machine learning notes - gray wolf optimization
[recruitment position] infrastructure software developer
Easyocr character recognition
做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
机器学习框架简述
Database learning - Database Security