JavaScript charAt() Method
Complete String Object Reference
Definition and Usage
The charAt() method returns the character at a specified position.
Syntax
stringObject.charAt(index)
|
Parameter |
Description |
index |
Required. A number representing a position in the string |
Tips and Notes
Note: The first character in the string is at position 0.
Example
In the string "Hello world!", we will return the character
at position 1:
<script type="text/javascript">
var str="Hello world!";
document.write(str.charAt(1));
</script>
|
The output of the code above will be:
Try-It-Yourself Demos
charAt()
How to use charAt() to get certain characters out of a string.
Complete String Object Reference
Whether you're new to XML or already an advanced user, the user-friendly views
and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to
meet your XML and Web services development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a fully functional free 30-day trial today!
|