当前位置:网站首页>?位置怎么写才能输出true
?位置怎么写才能输出true
2022-06-28 04:13:00 【张 邵】
var a = ?;
console.log(
a == 1 &&
a == 2 &&
a == 3
)
考点:== 运算符的运算规则,类型转换的规则
var obj = {
};
console.log(obj.valueOf()) //{} 非原始类型
console.log(obj.toString()) //'[object Object]'
所以
obj == 1 //false
obj == '[object Object]' // true
var obj = {
valueOf: function() {
return 1
}
};
obj == 1 //true
所以正解为
a = {
n: 1,
valueOf: function(){
return this.n++
}
}
变题: console.log(a == 1 &&a == 2 &&a == 4)
a = {
n: [1,2,4],
i:0,
valueOf: function(){
return this.n[this.i++]
}
}
边栏推荐
猜你喜欢

2022年中國音頻市場年度綜合分析

mysql修改密码报错需要怎么做

first. Net core MVC project

Introduction to multi project development, basic design class library project use

Detailed reading of the thesis: implementing volume models for handowriting text recognition

UI自動化測試框架搭建 —— 編寫一個APP自動化

TACo:一种关于文字识别的数据增强技术
![[CSP-J2020] 优秀的拆分](/img/05/90f9cf71791b3cdc37073eaf5db989.png)
[CSP-J2020] 优秀的拆分

What to do when MySQL changes the password and reports an error

Difference between curdate() and now()
随机推荐
Array method
求一个能判断表中数据,只填充不覆盖的sql
云厂商为什么都在冲这个KPI?
Introduction to multi project development, basic design class library project use
[Matlab bp regression prediction] GA Optimized BP regression prediction (including comparison before optimization) [including source code 1901]
抖音實戰~關注博主
Notepad++ -- common plug-ins
Win10 how to delete the large file hiberfil sys
有人用cdc同步到mysql发生过死锁吗?
Severe tire damage: the first rock band in the world to broadcast live on the Internet
Audio and video technology development weekly
MySQL gets the current date of the year
If mysqlcdc sets multiple parallelism, will the incremental data repeat?
Sword finger offer 47 Maximum gift value (DP)
Why are cloud vendors targeting this KPI?
Moonbeam integrates coin98, giving users more choices on the multi chain road
Why is the frame rate calculated by opencv wrong?
A bit of knowledge - online resources on Chinese Learning
10:00面试,10:02就出来了 ,问的实在是太...
Moonbeam集成Coin98,给予用户在多链道路上的更多选择