运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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 numb = 5; let text = numb.toString(); document.getElementById("demo").innerHTML = text.padEnd(4,"x"); </script> </body> </html>