How To Use String Object charCodeAt In Java Script

In this article I am going to explain about String Object charCodeAt In JavaScript.
  • 2065

Use charCodeAt() method in JavaScript

The charCodeAt() method returns Unicode value of the first character at the specified string.

The index will be start 0, like(0,1,2).

All browsers support string object charCodeAt method.




<!DOCTYPE html>


<body style ="background-color:red">


<p id="demo">Display the unicode of the first character in a string.</p>


<button onclick="myFunction()">Click here</button>


<script type="text/javascript">

    function myFunction()


        var str = "Welcome";

        var n = str.charCodeAt(0);

        document.getElementById("demo").innerHTML = n;








Further Readings

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.