Course contentsShow
← JavaScript
Lesson 183 of 2,7235. StringsFree lesson

What is Unicode and Why It Matters

Understand Unicode as a universal character encoding system and why JavaScript uses it for strings.

What is Unicode and Why It Matters

You'll learn: What Unicode is and why JavaScript relies on it to represent text from every language in the world.

The Problem Unicode Solves

Imagine if every country used completely different electrical outlets and voltages—your phone charger would be useless traveling abroad. Before Unicode, computers faced a similar problem with text: different systems used different encoding systems to represent characters. An English "A" might work fine, but Chinese characters, Arabic script, or emojis would display as gibberish when moved between systems.

What Unicode Is

Unicode is a universal standard that assigns a unique number (called a "code point") to every character from every writing system—including letters, numbers, symbols, and even emojis. Think of it as a master catalog where every character has a permanent ID number.

For example:

  • The letter "A" is code point 65
  • The emoji "😀" is code point 128512
  • The Chinese character "中" is code point 20013

Why JavaScript Uses Unicode

JavaScript strings are built on Unicode, which means you can work with text in any language without worrying about compatibility. When you create a string like "Hello 你好 مرحبا", JavaScript stores each character using its Unicode code point. This ensures your strings display correctly everywhere—in browsers, on servers, and across different operating systems.

Without Unicode, JavaScript would only handle a limited set of characters, making it useless for international applications.

The Takeaway

Key Takeaway: Unicode is the universal system that gives every character a unique number, and JavaScript uses it to make strings work reliably with any language or symbol worldwide.