The charCodeAt() method returns the Unicode of the character at the specified index in a string.
The index of the first character is 0, the second character 1, and so on.
Code:-
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>charCodeAt()</h1>
<input type="button" onclick="strfun();" value="Get Answer">
<script>
function strfun()
{
var str = "Testing";
alert(str.charCodeAt(2)); //Returns 's' ASCII code
}
</script>
</body>
</html>
JavaScript charcodeAt:- Geniusofstudent
Reviewed by
Network security
on
June 24, 2019
Rating:
5
No comments: