Related Articles

Related Articles

JavaScript String.fromCodePoint() Method
  • Last Updated : 03 Sep, 2020

Below is the example of the String.fromCodePoint() Method.

  • Example:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <script> 
        a = String.fromCodePoint(71, 70, 71); 
        document.write(a);
    </script> 

    chevron_right

    
    

  • Output:
    GFG

The String.fromCodePoint() is an inbuilt method in JavaScript which is used to return a string or an element for the given sequence of code point value (ASCII value).
List of code point values of different elements:

Syntax:

String.fromCodePoint(a1, a2, a3, ....)

Parameters: Here parameter a1, a2 etc are the sequence of code point values.

Return value: It returns the corresponding string or elements for the given sequence of code point values.



JavaScript code to show the working of String.fromCodePoint() method:
Code #1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<script>
  
    // Taking some code point values
    a = String.fromCodePoint(42);
    b = String.fromCodePoint(65, 90);
    c = String.fromCodePoint(66, 65, 102);
  
    // Printing the corresponding elements of
    // the code point value.
    document.write(a + "<br>")
    document.write(b + "<br>")
    document.write(c + "<br>")
  
</script>

chevron_right


Output:

*
AZ
BAf

Code #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<script>
    // Taking some code point values
    a = String.fromCodePoint(71,101,101,107,115);
  
    // Printing the corresponding elements of
    // the code point value.
    document.write(a + "<br>")
</script>

chevron_right


Output:

Geeks

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :