当前位置:网站首页>? How to write the position to output true
? How to write the position to output true
2022-06-28 05:19:00 【Zhangshao】
var a = ?;
console.log(
a == 1 &&
a == 2 &&
a == 3
)
Examination site :== The operation rules of operators , Rules for type conversion 
var obj = {
};
console.log(obj.valueOf()) //{} Non primitive type
console.log(obj.toString()) //'[object Object]'
therefore
obj == 1 //false
obj == '[object Object]' // true
var obj = {
valueOf: function() {
return 1
}
};
obj == 1 //true
So the positive solution is
a = {
n: 1,
valueOf: function(){
return this.n++
}
}
Change questions : console.log(a == 1 &&a == 2 &&a == 4)
a = {
n: [1,2,4],
i:0,
valueOf: function(){
return this.n[this.i++]
}
}
边栏推荐
- 羧酸研究:Lumiprobe 磺基花青7二羧酸
- 吴恩达深度学习测验题:deeplearning.ai-week1-quiz
- Sqlmap tool user manual
- 2022年材料员-通用基础(材料员)操作证考试题库及答案
- 乔布斯在斯坦福大学的演讲稿——Follow your heart
- openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
- msa. h: There is no such file or directory
- Feign implements path escape through custom annotations
- 程序员-放羊娃
- When excel copies the contents of a row, the columns are separated by the tab "\t"
猜你喜欢

A guide to P2P network penetration (stun) for metartc5.0 programming

Store inventory management system source code

OpenSSL client programming: SSL session failure caused by an obscure function

How to do a good job of gateway high availability protection in the big promotion scenario

开关电源电压型与电流型控制
![[JVM series] JVM tuning](/img/e1/086f76ec6c9b56d97430b1e073f5a6.png)
[JVM series] JVM tuning

!‘ Cat 'is not an internal or external command, nor is it a runnable program or batch file.

CPG 固体支持物研究:Lumiprobe通用 CPG II 型

Lumiprobe cell imaging analysis: PKH26 cell membrane labeling kit

How does the power outlet transmit electricity? Simple problems that have plagued my little friend for so many years
随机推荐
程序员坐牢了,会被安排去写代码吗?
Wireless sensor network learning notes (I)
2022西式面点师(高级)考试试题模拟考试平台操作
sqlmap工具使用手册
OpenSSL client programming: SSL session failure caused by an obscure function
创新之源 理解通透 二
Carboxylic acid study: lumiprobe sulfoacyanine 7 dicarboxylic acid
Disable right-click, keyboard open console events
CpG solid support research: lumiprobe general CpG type II
IP datagram sending and forwarding process
The short video local life section has become popular. How to grasp the new opportunities?
Learn Taiji Maker - mqtt Chapter 2 (IV) esp8266 reserved message application
Learning Tai Chi Maker - mqtt Chapter 2 (V) heartbeat mechanism
Learning Tai Chi Maker - mqtt Chapter II (VI) mqtt wills
Study on modified triphosphate: lumiprobe amino-11-ddutp
短视频本地生活版块成为热门,如何把握新的风口机遇?
2022 Western pastry (Advanced) test question simulation test platform operation
A guide to P2P network penetration (stun) for metartc5.0 programming
Don't roll! How to reproduce a paper with high quality?
lotus v1.16.0 calibnet