A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Strict_equality below:

일치 연산자 (===) - JavaScript

일치 연산자 (===)

Baseline Widely available

일치 연산자 (===) 는 두 피연산자가 동일한지 확인하며, 불리언 결과를 반환합니다. 동등 연산자와는 다르게, 일치 연산자는 두 피연산자의 타입이 다르면 동일하지 않다고 여깁니다.

시도해 보기
console.log(1 === 1);
// Expected output: true

console.log("hello" === "hello");
// Expected output: true

console.log("1" === 1);
// Expected output: false

console.log(0 === false);
// Expected output: false
문법 설명

일치 연산자 (=== 와 !==)는 두 피연산자를 비교하기 위해 엄격한 같음을 사용합니다.

일치 연산자와 동등 연산자 (==)의 가장 눈에 띄는 차이점은 피연산자들의 타입이 다를 경우, == 연산자는 비교하기 전에 같은 타입으로 변환을 시도한다는 점입니다.

예제 같은 타입의 피연산자 비교
"hello" === "hello"; // true
"hello" === "hola"; // false

3 === 3; // true
3 === 4; // false

true === true; // true
true === false; // false

null === null; // true
다른 타입의 피연산자 비교
"3" === 3; // false
true === 1; // false
null === undefined; // false
3 === new Number(3); // false
객체 간의 비교
const object1 = {
  key: "value",
};

const object2 = {
  key: "value",
};

console.log(object1 === object2); // false
console.log(object1 === object1); // true
명세서 브라우저 호환성 같이 보기

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4