| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/toString | [Back] [Original] |
Get to know MDN better
const stringObj = new String("foo");
console.log(stringObj);
// : String { "foo" }
console.log(stringObj.toString());
// : "foo"
toString()
String Object toString Object.prototype.toString() String toString String.prototype.valueOf()
toString() this String this TypeError
String [Symbol.toPrimitive]() JavaScript toString() String toString()
String.prototype.toString = () => "Overridden";
console.log(`${"foo"}`); // "foo"
console.log(`${new String("foo")}`); // "Overridden"
const x = new String("Hello world");
console.log(x.toString()); // "Hello world"
| ECMAScript 2027 LanguageSpecification # sec-string.prototype.tostring |
Stringanchor()at()big()blink()bold()charAt()charCodeAt()codePointAt()concat()endsWith()fixed()fontcolor()fontsize()includes()indexOf()isWellFormed()italics()lastIndexOf()link()localeCompare()match()matchAll()normalize()padEnd()padStart()repeat()replace()replaceAll()search()slice()small()split()startsWith()strike()sub()substr()substring()sup()toLocaleLowerCase()toLocaleUpperCase()toLowerCase()toString()toUpperCase()toWellFormed()trim()trimEnd()trimStart()valueOf()[Symbol.iterator]()Object/Function| Web Proxy Viewer | New URL | Original Page |