Boolean.prototype.toString()
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ì.
toString() ë©ìëë Boolean ê°ì²´ë¥¼ ëíë´ë 문ìì´ì ë°íí©ëë¤.
ìëí´ ë³´ê¸°
const flag1 = new Boolean(true);
console.log(flag1.toString());
// Expected output: "true"
const flag2 = new Boolean(1);
console.log(flag2.toString());
// Expected output: "true"
구문
js
bool.toString();
ë°í ê°
Boolean ê°ì²´ë¥¼ ëíë´ë 문ìì´.
ì¤ëª
Boolean ê°ì²´ë Object.prototype.toString() ë©ìë를 ììë°ì§ ìê³ ì¬ì ìí©ëë¤. Boolean ê°ì²´ìì toString() ë©ìëë ê°ì²´ì 문ìì´ ííì ë°íí©ëë¤.
JavaScriptë Booleanì 문ìì´ë¡ ííí´ì¼ í ëë 문ìì´ ê²°í©ì ì¬ì©í ë toString()ì ìëì¼ë¡ í¸ì¶í©ëë¤.
toString()ì ë¶ë¦¬ì¸ ê°ì²´ì ê°ì ë°ë¼ 문ìì´ "true" ëë "false"를 ë°íí©ëë¤.
ìì
>toString() ì¬ì©í기
js
var flag = new Boolean(true);
flag.toString(); // false
ëª ì¸
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-boolean.prototype.tostring> |