Core JavaScript
This section is a tour of the JavaScript language, and also a tour of Part I of this book. After this introductory chapter, we dive into JavaScript at the lowest level: Chapter 2, Lexical Structure, explains things like JavaScript comments, semicolons, and the Unicode character set. Chapter 3, Types, Values, and Variables, starts to get more interesting: it explains JavaScript variables and the values you can assign to those variables. Here’s some sample code to illustrate the highlights of those two chapters:
// Anything following double slashes is an English-language comment.// Read the comments carefully: they explain the JavaScript code.// A variable is a symbolic name for a value.// Variables are declared with the var keyword:varx;// Declare a variable named x.// Values can be assigned to variables with an = signx=0;// Now the variable x has the value 0x// => 0: A variable evaluates to its value.// JavaScript supports several types of valuesx=1;// Numbers.x=0.01;// Just one Number type for integers and reals.x="hello world";// Strings of text in quotation marks.x='JavaScript';// Single quote marks also delimit strings.x=true;// Boolean values.x=false;// The other Boolean value.x=null;// Null is a special value that means "no value".x=undefined;// Undefined is like null.
Two other very important types that JavaScript programs can manipulate are objects and arrays. These are the subject of Chapter 6, Objects, and Chapter 7, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access