7 6 3 character encodings in javascript c2 b6

Solutions on MaxInterview for 7 6 3 character encodings in javascript c2 b6 by the best coders in the world

showing results for - "7 6 3 character encodings in javascript c2 b6"
Andrés
25 Nov 2020
1/*The string method charCodeAt takes an index and returns the ASCII
2code of the character at that index.*/
3
4let nonprofit = "LaunchCode";
5
6console.log(nonprofit.charCodeAt(0));
7console.log(nonprofit.charCodeAt(1));
8console.log(nonprofit.charCodeAt(2));
9console.log(nonprofit.charCodeAt(3));
10console.log(nonprofit.charCodeAt(4));
11console.log(nonprofit.charCodeAt(5));
12console.log(nonprofit.charCodeAt(6));
13console.log(nonprofit.charCodeAt(7));
14console.log(nonprofit.charCodeAt(8));
15console.log(nonprofit.charCodeAt(9));
16
1776
1897
19117
20110
2199
22104
2367
24111
25100
26101
27
28
29/*To convert an ASCII code to an actual character, use 
30String.fromCharCode().*/
31
32let codes = [76, 97, 117, 110, 99, 104, 67, 111, 100, 101];
33
34let characters = String.fromCharCode(codes[0]) + String.fromCharCode(codes[1])
35               + String.fromCharCode(codes[2]) + String.fromCharCode(codes[3])
36               + String.fromCharCode(codes[4]) + String.fromCharCode(codes[5])
37               + String.fromCharCode(codes[6]) + String.fromCharCode(codes[7])
38               + String.fromCharCode(codes[8]) + String.fromCharCode(codes[9]);
39
40console.log(characters);