Thanks to visit codestin.com
Credit goes to developer.mozilla.org

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

할당 연산자 (=)

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015년 7월⁩.

할당(=) 연산자는 변수에 값을 대입하는 데 사용됩니다. 할당 연산은 할당된 값으로 평가됩니다. 할당 연산자를 연결하여 사용하면 단일 값을 여러 변수에 할당할 수 있습니다.

시도해 보기

let x = 2;
const y = 3;

console.log(x);
// Expected output: 2

console.log((x = y + 1)); // 3 + 1
// Expected output: 4

console.log((x = x * y)); // 4 * 3
// Expected output: 12

구문

js
x = y

예제

간단한 대입과 연결하여 사용

js
let x = 5;
let y = 10;
let z = 25;

x = y; // x 는 10입니다.
x = y = z; // x, y, z 는 모두 25입니다.

명세

Specification
ECMAScript® 2026 Language Specification
# sec-assignment-operators

브라우저 호환성

같이 보기