JavaScript charCodeAt() Method
Complete String Object Reference
Definition and Usage
The charCodeAt() method returns the Unicode of the character at a specified position.
Syntax
stringObject.charCodeAt(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 Unicode of the character
at position 1:
<script type="text/javascript">
var str="Hello world!";
document.write(str.charCodeAt(1));
</script>
|
The output of the code above will be:
Try-It-Yourself Demos
charCodeAt()
How to use charCodeAt() to get the Unicode for certain characters out of a string.
Complete String Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|