运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Strings</h1> <h2>The charAt() Method</h2> <p>charAt() returns the character at a specified index (position) in a string.</p> <p>Index out of range returns empty string.</p> <p id="demo"></p> <script> let text = "HELLO WORLD"; let letter = text.charAt(15); document.getElementById("demo").innerHTML = letter; </script> </body> </html>