当前位置:网站首页>? 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++]
}
}
边栏推荐
- Latest Windows version 5.0.14 of redis
- Understanding the source of innovation II
- 乔布斯在斯坦福大学的演讲稿——Follow your heart
- 现代交换原理MOOC部分题目整理
- When using the MessageBox of class toplevel, a problem pops up in the window.
- 【JVM系列】JVM调优
- 如何学习可编程逻辑控制器(PLC)?
- 【牛客网刷题系列 之 Verilog快速入门】~ 四选一多路器
- 【Linux】——使用xshell在Linux上安装MySQL及实现Webapp的部署
- Operation of simulated examination platform of G3 boiler water treatment recurrent training question bank in 2022
猜你喜欢

Learning Tai Chi Maker - mqtt Chapter II (VI) mqtt wills

BioVendor sRAGE蛋白解决方案

How to design an awesome high concurrency architecture from scratch (recommended Collection)

metaRTC5.0编程之p2p网络穿透(stun)指南

改性三磷酸盐研究:Lumiprobe氨基-11-ddUTP

2022年最新辽宁建筑八大员(标准员)考试试题及答案

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

吴恩达深度学习测验题:deeplearning.ai-week1-quiz

Dart学习——函数、类

2022 low voltage electrician examination questions and answers
随机推荐
Prove that there are infinite primes / primes
mysql导出数据库字典成excel文件
Programmer - Shepherd
Sorting out some topics of modern exchange principle MOOC
活性染料研究:Lumiprobe AF594 NHS 酯,5-异构体
Learning Tai Chi Maker - mqtt Chapter 2 (V) heartbeat mechanism
Learn Taiji Maker - mqtt Chapter 2 (IV) esp8266 reserved message application
Hundreds of lines of code to implement a script interpreter
深度强化学习笔记
Extjs library management system source code intelligent library management system source code
8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
sqlmap工具使用手册
吴恩达深度学习测验题:deeplearning.ai-week1-quiz
How to design an awesome high concurrency architecture from scratch (recommended Collection)
【无标题】drv8825步进电机驱动板子原理图
metaRTC5.0 API编程指南(一)
The short video local life section has become popular. How to grasp the new opportunities?
JS text box loses focus to modify width text and symbols
Camera Basics
gorm事务体验