Literal Basics
The term "literal", in this context, comes from computer science, where a
Object Literal: This is enclosed by { } and consists of a key (String or Number) and a value (any type) separated by a colon, with each entry separated by a comma.
const myObject = {
"a_prop": "a string",
"a _second_prop": 3,
7: false
}
Literals defining Arrays: Arrays defined with a literal are wrapped in [] and separate values with a comma.
let nameArray = {
"Tom",
"John",
"Tia"
}
// RESULTS IN: Tom,John,Tia
Literals defining Regular Expressions: When not using literal syntax to create regular expressions, we must start by escaping with two backslashes. This is not required with literals, making literal syntax far more common. We only need a forward slash at the beginning and end.
The literal example below represents a regex expression for a number:
const literalRegEx = /d+/Template Literals (Strings)
`A long sample string with a ${variable} mixed in`
There are many good examples of all that can be included in


















