运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Strings</h1> <h2>The at() Method</h2> <p>The at() method returns an indexed character from a string.</p> <p>An index of -1 returns the last character from the string.</p> <p id="demo"></p> <script> let text = "W3schools"; let character = text.at(-1); document.getElementById("demo").innerHTML = character; </script> </body> </html>