字面量

字面量(Literal),又名直接量,即程序中直接使用的数据值。

// Null 字面量
const n = null;

// Undefined 字面量
const u = undefined;

// Boolean 布尔值字面量
const b1 = true;
const b2 = false;

// Number 数值字面量
const num = 1;
const nan = NaN;

// String 字符串字面量
const hello = 'hello';
const world = 'world';

// Regexp 正则字面量
const reg = /pattern/;

// Template Literal 模版字面量
const temp = `hello, ${world}`