How To Use String Object fromCharCode In Java Script

In this article I am going to explain about String Object fromCharCode In JavaScript.
  • 2447

Use fromCharCode() method in JavaScript

The fromCharCode() method is change the character value into Unicode value.

This is a static method of the String object in JavaScript.

The syntax is always use String.fromCharCode() .

All browsers support string object fromCharCode() method.

Syntax

String.fromCharCode(n1, n2, ..., nX)

Example

<!DOCTYPE html>

<html>

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

 

<p id="demo">Display character of the specified unicode number.</p>

 

<button onclick="myFunction()">Try it</button>

 

<script type="text/javascript">

    function myFunction()

     {

        var n = String.fromCharCode(87);

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

    }

</script>

 

</body>

</html>

Output1

 op1.jpg

Output2

 op2.jpg

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

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.