| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/String/padStart | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since 20174.
padStart() ()
str.padStart(targetLength [, padString])
targetLengthpadString " " (U+0020).
"abc".padStart(10); // " abc"
"abc".padStart(10, "foo"); // "foofoofabc"
"abc".padStart(6, "123465"); // "123abc"
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-string.prototype.padstart |
This page was last modified on 2025714 by MDN contributors.
Stringanchor()at()big()blink()bold()charAt()charCodeAt()codePointAt()String.prototype.concat()endsWith()fixed()fontcolor()fontsize()includes()indexOf()isWellFormed()italics()lastIndexOf()link()String.prototype.localeCompare()match()matchAll()normalize()padEnd()String.prototype.padStart()repeat()replace()replaceAll()search()slice()small()split()startsWith()strike()sub()substr()substring()sup()toLocaleLowerCase()toLocaleUpperCase()String.prototype.toLowerCase()toString()toUpperCase()toWellFormed()String.prototype.trim()trimEnd()trimStart()valueOf()[Symbol.iterator]()Object/FunctionYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |