String.fromCharCode()

  • Revision slug: JavaScript/Reference/Global_Objects/String/fromCharCode
  • Revision title: fromCharCode
  • Revision id: 26144
  • Created:
  • Creator: Maian
  • Is current revision? No
  • Comment Core JavaScript 1.5 Reference:Objects:String:fromCharCode moved to Core JavaScript 1.5 Reference:Global Objects:String:fromCharCode

Revision Content

Summary

Returns a string created by using the specified sequence of Unicode values.

Method of String

Static

Implemented in: JavaScript 1.2, NES3.0

JavaScript 1.3: Uses a Unicode value rather than an ISO-Latin-1 value.

ECMA Version: ECMA-262

Syntax

String.fromCharCode(num1, ..., numN)

Parameters

num1, ..., numN 
A sequence of numbers that are Unicode values.

Description

This method returns a string and not a String object.

Because fromCharCode is a static method of String, you always use it as String.fromCharCode(), rather than as a method of a String object you created.

Backward Compatibility

JavaScript 1.2

The fromCharCode method returns a string created by using the specified sequence of ISO-Latin-1 codeset values.

Examples

Example: Using fromCharCode

The following example returns the string "ABC".

String.fromCharCode(65,66,67)

Revision Source

<p>
</p>
<h3 name="Summary"> Summary </h3>
<p>Returns a string created by using the specified sequence of Unicode values.
</p>
<table class="fullwidth-table">
<tbody><tr>
<td class="header" colspan="2">Method of <a href="en/Core_JavaScript_1.5_Reference/Objects/String">String</a></td>
</tr>
<tr>
<td colspan="2">
<p><b>Static</b>
</p>
</td>
</tr>
<tr>
<td>Implemented in:</td>
<td>JavaScript 1.2, NES3.0
<p>JavaScript 1.3: Uses a Unicode value rather than an ISO-Latin-1 value.
</p>
</td>
</tr>
<tr>
<td>ECMA Version:</td>
<td>ECMA-262</td>
</tr>
</tbody></table>
<h3 name="Syntax"> Syntax </h3>
<p><code>
String.fromCharCode(<i>num1</i>, <i>...</i>, <i>numN</i>)
</code>
</p>
<h3 name="Parameters"> Parameters </h3>
<dl><dt> <code>num1, ..., num<i>N</i></code> </dt><dd> A sequence of numbers that are Unicode values.
</dd></dl>
<h3 name="Description"> Description </h3>
<p>This method returns a string and not a <code>String</code> object.
</p><p>Because <code>fromCharCode</code> is a static method of <code>String</code>, you always use it as <code>String.fromCharCode()</code>, rather than as a method of a <code>String</code> object you created. 
</p>
<h3 name="Backward_Compatibility"> Backward Compatibility </h3>
<h4 name="JavaScript_1.2"> JavaScript 1.2 </h4>
<p>The <code>fromCharCode</code> method returns a string created by using the specified sequence of ISO-Latin-1 codeset values.
</p>
<h3 name="Examples"> Examples </h3>
<h4 name="Example:_Using_fromCharCode"> Example: Using <code>fromCharCode</code> </h4>
<p>The following example returns the string "ABC".
</p>
<pre>String.fromCharCode(65,66,67)
</pre>
Revert to this revision