| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/isWellFormed | [Back] [Original] |
Get to know MDN better
isWellFormed()
true false
JavaScript UTF-16 UTF-16 UTF-16 Unicode
isWellFormed() isWellFormed() toWellFormed() isWellFormed()
const strings = [
//
"ab\uD800",
"ab\uD800c",
//
"\uDFFFab",
"c\uDFFFab",
//
"abc",
"ab\uD83D\uDE04c",
];
for (const str of strings) {
console.log(str.isWellFormed());
}
// Logs:
// false
// false
// false
// false
// true
// true
encodeURI isWellFormed() encodeURI()
const illFormed = "https://example.com/search?q=\uD800";
try {
encodeURI(illFormed);
} catch (e) {
console.log(e); // URIError: URI malformed
}
if (illFormed.isWellFormed()) {
console.log(encodeURI(illFormed));
} else {
console.warn(""); //
}
| ECMAScript 2027 LanguageSpecification # sec-string.prototype.iswellformed |
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 |