Advertisement
fcamuso

Javascript ES13, video 12

Dec 28th, 2021
1,121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="it-IT">
  3. <head>
  4.   <meta charset="UTF-8">
  5.   <title>Unicode</title>
  6. </head>
  7. <body>
  8.   <script>
  9.     const s1 = "A";
  10.     const s2 = "遰";
  11.     const s3 = "ciao";
  12.     const s4 = "🚀";
  13.  
  14.     console.log(s1.length);
  15.     console.log(s2.length);
  16.     console.log(s3.length);
  17.     console.log(s4.length);
  18.    
  19.     console.log(s3.charCodeAt(0));
  20.     console.log(s3[0]);
  21.  
  22.     console.log("\u{9070}");
  23.  
  24.     console.log(s2.charCodeAt(0));
  25.     console.log(s2[0]);
  26.  
  27.     console.log(s4.charCodeAt(0));
  28.     console.log(s4.charCodeAt(1));
  29.  
  30.     console.log(s4[0]);
  31.     console.log(s4[1]);
  32.     console.log(s4[0]+s4[1]);
  33.     console.log("\u{d83d}\u{de80}");
  34.  
  35.     console.log( s4.codePointAt(0) );
  36.     console.log( s4.codePointAt(1) );
  37.     console.log("\u{1f680}");
  38.     console.log("\u{de80}");
  39.  
  40.     console.log('mañana' === 'mañana'); //https://mathiasbynens.be/notes/javascript-unicode
  41.     console.log('mañana'.length + " " + 'mañana'.length);
  42.  
  43.  
  44.  
  45.  
  46.  
  47.   </script>
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement