í ë¹ ì°ì°ì (=)
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® 2027 Language Specification> # sec-assignment-operators> |