Prev Demo
Charat Method For Returning The Last Character
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>charAt() method for returning last character</h1> <p>Click on the "Button" for returning the last character of a string "SN ITFunda Service LLP".</p> <input type="button" value="Button" onclick="Function()"/> <p id="myId"></p> <script> function Function() { var a = "SN ITFunda Service LLP"; var res = a.charAt(a.length-1); document.getElementById("myId").innerHTML = res; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output