当前位置:网站首页>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
边栏推荐
- Interpretation of Apache linkage parameters in computing middleware
- [12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!
- The difference between SQL Server char nchar varchar and nvarchar
- Coding devsecops helps financial enterprises run out of digital acceleration
- GPS原始坐标转百度地图坐标(纯C代码)
- JMeter performance test: serveragent resource monitoring
- NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
- Detailed explanation of QT creator breakpoint debugger
- Calculate weight and comprehensive score by R entropy weight method
- I spring and autumn blasting-2
猜你喜欢

Bugku's Ping

Common MySQL interview questions

Redis' transaction mechanism

Drive brushless DC motor based on Ti drv10970

Machine learning notes - gray wolf optimization

Two Bi development, more than 3000 reports? How to do it?

sql server学习笔记

超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜

I spring and autumn blasting-1

Ecotone technology has passed ISO27001 and iso21434 safety management system certification
随机推荐
Under the crisis of enterprise development, is digital transformation the future savior of enterprises
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
Common MySQL interview questions
mapper.xml文件中的注释
爱可可AI前沿推介(7.5)
Crud of MySQL
Leetcode: Shortest Word Distance II
Ctfshow web entry information collection
lvgl 显示图片示例
社区团购撤城“后遗症”
Cartoon: programmers don't repair computers!
美团优选管理层变动:老将刘薇调岗,前阿里高管加盟
[JVM] operation instruction
Jmeter性能测试:ServerAgent资源监控
Install and configure Jenkins
qt creater断点调试程序详解
What are CSRF, XSS, SQL injection, DDoS attack and timing attack respectively and how to prevent them (PHP interview theory question)
mapper. Comments in XML files
Bugku's eyes are not real
[recruitment position] Software Engineer (full stack) - public safety direction