Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “There are several possible results: a single value with the reduce() operation, a new array with map(), or just about any kind of result with forEach().”
A block of code is set as follows:
// reverse.ts
const reverseString = (str: string): string => {
const arr = str.split("");
arr.reverse();
return arr.join("");
};
console.log(reverseString("MONTEVIDEO")); // OEDIVETNOM
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
// continued...
const reverseString2 = (str: string): string =>
str.split("").reduceRight((x, y) => x + y, "");
console.log(reverseString2("OEDIVETNOM")); // MONTEVIDEO
Any command-line input or output is written as follows:
START MAP 2022-10-29T01:47:06.726Z [ 10, 20, 30, 40 ] END MAP
Bold: Indicates a new term, an important word, or words that you see onscreen.
Tips or important notes
Appear like this.