Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Javascript JavaScript method fromCharCode()

Related Tutorials


 
 

Share on Google+Share on Google+

JavaScript method fromCharCode()

Advertisement
This section illustrates you the use of JavaScript method fromCharCode(). The fromCharCode() method returns a readable string from the specified sequence of Unicode character values.

JavaScript method fromCharCode()

     

This section illustrates you the use of JavaScript method fromCharCode(). The fromCharCode() method returns a readable string from the specified sequence of Unicode character values. 

Its Syntax is:

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

The argument  'n' is the series of Unicode character values. This method is a static method of String and cannot be used as a method of a String object that you have created. In the given example, we have used this method which translate the specified sequence of Unicode character values into the text. Here, we have specified the Unicode values of English alphabets and the Unicode values of HELLOWORLD.

Here is the code:

<html>
<h2>Use of method fromCharCode()</h2>
<script type="text/javascript">
document.write(String.fromCharCode(72,69,76,76,79,87,79,82,76,68));
document.write("<br />");
document.write("English Alphabets:")
document.write(String.fromCharCode(65, 66, 67, 68, 69, 70, 71, 72, 73, 
   74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,90));
</script>
</html>

Output will be displayed as:

From the above output, you will see that the Unicode values that you have specified are converted into the texts:

Download Source Code

     

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 3, 2006

Related Tutorials

Discuss: JavaScript method fromCharCode()  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
masoud
April 15, 2011
thank for admin this website

I thank you to this website I want you help me to learn java script and I love java script by pdf than you
DMCA.com