1.7 Notations and conventions
1.7.1 What is a type signature? Why am I seeing static types in this book?
For example, you may see:
Number.isFinite(num: number): boolean
That is called the type signature of Number.isFinite()
. This notation, especially the static types number
of num
and boolean
of the result, are not real JavaScript. The notation is borrowed from the compile-to-JavaScript language TypeScript (which is mostly just JavaScript plus static typing).
Why is this notation being used? It helps give you a quick idea of how a function works. The notation is explained in detail in a 2ality blog post, but is usually relatively intuitive.
1.7.2 What do the notes with icons mean?
Reading instructions
Explains how to best read the content.
External content
Points to additional, external, content.
Tip
Gives a tip related to the current content.
Question
Asks and answers a question pertinent to the current content (think FAQ).
Warning
Warns about pitfalls, etc.
Details
Provides additional details, complementing the current content. It is similar to a footnote.