執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Strings</h1> <h2>The padEnd() Method</h2> <p>The padEnd() method pads a string at the end.</p> <p>It pads the string with another string (multiple times) until it reaches a given length.</p> <p id="demo"></p> <script> let text = "5"; text = text.padEnd(4,"0"); document.getElementById("demo").innerHTML = text; </script> </body> </html>