当前位置:网站首页>===、==、Object. Is basic package type
===、==、Object. Is basic package type
2022-07-25 00:13:00 【Ares-Wang】





// == Comparison of original values , When different data types are compared, they will be converted ( character string ——》 The number , Boolean——>0|1, as well as valueOf、toString)
undefined
const obj1={username:‘Ares_Wang’}
const obj= {username:‘Ares_Wang’}
const obj2=obj1;// Object is a reference type , Assign a value here , Just assign the direction to obj2
undefined
objobj1
false
obj1obj2
true
// If all comparisons are objects ( Non value type ), Only when both operand references an object, it returns true.
undefined
nullundefined
true
// Comparison of different types
undefined
12’12’ // When comparing strings and numbers , The string is implicitly converted to a numeric value
true
true1 //boolean When compared with the numerical value ,Boolean Will implicitly convert true->1 false——>0
true
true’1’ // character string -> The number , true->1
true
true==‘3’ // character string - The number ’3‘——>3 true——>1 31 false
false
Number(1)1 // Objects and values Objects will use valueOf Implicitly convert to the original value Number(1)——>1 Number(1) It's a wrapper
true
String(‘123’)‘123’ // Object and string Objects will use tostring Implicitly convert to the original value String(’xxxx‘) It's also a wrapper
true
// Basic packaging type Life cycle , After packaging , Destroy immediately .
undefined
let s=‘Ares-Wang’
undefined
var s1=new String(s)
var s2=String(s)
undefined
s1=s2
false
s1=s
false
s2=s
true
s1.x=‘5’
‘5’
s2.x=‘5’ //S2 Basic packaging type Assignment completed , Immediately destroyed
‘5’
s1.x
‘5’
s2.x=‘5’ //S2 Basic packaging type Assignment completed , Immediately destroyed
‘5’
s2.x
undefined
//=== Strict mode comparison The comparison contains data types And the value
undefined
//=== The comparison contains data types therefore Different data types Definitely not equal , Reference type only refers to the same object to return true
undefined
12===‘12’
false
1=true
false
null=null
true
undefined=null
false
undefined=undefined
true
+0=0
true
NaN=NaN // == === The results are the same All back to false
false
//Object.is() Much like the third-order operator , But there are still some differences , For example, for NaN, about +0 and -0 Comparison between .
undefined
Object.is(NaN,NaN)
true
Object.is(null,null)
true
Object.is(0,+0)
true
Object.is(null,undefined)
false
Object.is(undefined,undefined)
true
边栏推荐
- Excel file processing tool class (based on easyexcel)
- Shell echo command
- See project code Note 1
- Efficiency increased by 98%! AI weapon behind operation and maintenance inspection of high altitude photovoltaic power station
- Leetcode 1260. two dimensional grid migration: two solutions (k simulations / one step)
- Quartus:17.1版本的Quartus安装Cyclone 10 LP器件库
- 在混合云中管理数据库:八个关键注意事项
- Why do I have to clean up data?
- [mindspore] [training warning] warning when executing training code
- Install Kaspersky 2018 under win server 2012 R2
猜你喜欢

4. Immersion test

NXP i.mx6q development board software and hardware are all open source, and the schematic diagram of the core board is provided

Coding builds an image, inherits the self built basic image, and reports an error unauthorized: invalid credential Please confirm that you have entered the correct user name and password.
![[LeetCode周赛复盘] 第 83 场双周赛20220723](/img/db/c264c94ca3307d4363d3cf7f5d770b.png)
[LeetCode周赛复盘] 第 83 场双周赛20220723

Beisen prospectus: the advantages of the track are prominent, and integration + medium and large customers are plus points

How painful is it to write unit tests? Can you do it

From the big guy baptism! 2022 headline first hand play MySQL advanced notes, and it is expected to penetrate P7

Soft test --- fundamentals of programming language (Part 2)

HTB-Aragog

@Mapkey usage instructions
随机推荐
ROS机械臂 Movelt 学习笔记3 | kinect360相机(v1)相关配置
Lambda&Stream
Grafana - influxdb visual K6 output
Sql文件导入数据库-保姆级教程
Netease game Flink SQL platform practice
Click the "native practice" search box to expand the special effect so that you can realize it. How will you realize it?
LeetCode_6124_第一个出现两次的字母
Multithreading & high concurrency (the latest in the whole network: interview questions + map + Notes) the interviewer is calm
UART
Pointers and arrays
Qt学习-利用数据库单例完成 登录匹配 + 注册 功能实现
[Nuxt 3] (十)运行时配置
Docker container Django + MySQL service
Promtool Check
cloud chart
Oracle is not null cannot filter null values
QT learning - using database singleton to complete login matching + registration function
C language: deep analysis function stack frame
[leetcode weekly replay] 303rd weekly 20220724
Install K6 test tool