当前位置:网站首页>?位置怎么写才能输出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++]
}
}
边栏推荐
- 视频直播系统源码,倒计时显示,商品秒杀倒计时
- 测试/开发程序员真的是青春饭吗?世界是公平的,咱们都凭实力说话......
- JVM I: introduction to JVM and understanding of class files
- 10:00面试,10:02就出来了 ,问的实在是太...
- Multi thread implementation rewrites run (), how to inject and use mapper file to operate database
- Go language learning tutorial (14)
- On the necessity of building a video surveillance convergence platform and its scenario application
- [applet] solution document using font awesome Font Icon (picture and text)
- 如何遍历collections.OrderedDict,服了又忘记items
- OracleData安装问题
猜你喜欢
UI自動化測試框架搭建 —— 編寫一個APP自動化
first. Net core MVC project
[CSP-J2020] 优秀的拆分
Taco: a data enhancement technique for character recognition
2022年中国音频市场年度综合分析
Severe tire damage: the first rock band in the world to broadcast live on the Internet
Analyse complète annuelle du marché chinois de l'audio en 2022
Introduction to multi project development, basic design class library project use
mysql修改密码报错需要怎么做
抖音實戰~關注博主
随机推荐
恭喜我自己,公众号粉丝破万
Tiktok actual battle ~ take off the blogger
Flinkcdc collects Oracle, and the Oracle database is CDB's
The second round of free public classes of the red team is coming ~ 8:00 tomorrow night!
Find an SQL that can judge the data in the table and only fill in the SQL that is not overwritten
Play with double pointer
Multi thread implementation rewrites run (), how to inject and use mapper file to operate database
A queue of two stacks
2022年中國音頻市場年度綜合分析
100+ data science interview questions and answers Summary - machine learning and deep learning
How do I get the STW (pause) time of a GC (garbage collector)?
Digital promising, easy to reach, Huawei accelerates the layout of the commercial market with "five pole" star products
Pinda general permission system (day 5~day 6)
Ppt production tips
MySQL gets the current date of the year
Severe tire damage: the first rock band in the world to broadcast live on the Internet
Sum of squares of each bit of a number
On the necessity of building a video surveillance convergence platform and its scenario application
抖音实战~取关博主
Resolve cross domain