Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yihan12 authored Dec 15, 2023
1 parent 4df67ac commit 6720463
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions javascript/Equality Comparisons/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# js的相等性判断
JavaScript 提供三种不同的值比较运算:

- ===——严格相等(三个等号)
- ==——宽松相等(两个等号)
- Object.is()

- IsLooselyEqual:==
- IsStrictlyEqual:===
- SameValue:Object.is()
- SameValueZero:被许多内置运算使用


# 双等号(==)

```javascript
const num = 0;
const big = 0n;
const str = "0";
const obj = new String("0");

console.log(num == str); // true
console.log(big == num); // true
console.log(str == big); // true

console.log(num == obj); // true
console.log(big == obj); // true
console.log(str == obj); // true
```

# 三等号(===)

# Object.is()

0 comments on commit 6720463

Please sign in to comment.