Characters

Q: A string is "a series of characters"... but what is a character?

A: a character is a number (or character code) that stands for a symbol.

symbol code name
A 65 capital A
B 66 capital B
Z 90 capital Z
_ 95 underscore
a 97 lowercase A
??? 10 newline

(Some characters stand for unprintable symbols like newline or tab or bell.)

ASCII and ye shall receive-ski

ASCII Table

(image from Wikimedia Commons)

Unicode

Unicode Strings

JavaScript strings are Unicode

That means you can use emoji in your JavaScript programs!

Like this:

"😂".repeat(20)

(sadly this doesn't work in Windows PowerShell, but it does work in Atom+node, like this:)

  response.setHeader('content-type', 'text/html');
  response.write('<meta charset="UTF-8">')
  response.write("😂".repeat(20));
  response.end();

Unicode Encodings

[TODO: diagrams]

Locales

Collations

Next Lesson 

Outline

[menu]

/