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:

  1. 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?

1.7 Notations and conventions - 图1 Reading instructions

Explains how to best read the content.

1.7 Notations and conventions - 图2 External content

Points to additional, external, content.

1.7 Notations and conventions - 图3 Tip

Gives a tip related to the current content.

1.7 Notations and conventions - 图4 Question

Asks and answers a question pertinent to the current content (think FAQ).

1.7 Notations and conventions - 图5 Warning

Warns about pitfalls, etc.

1.7 Notations and conventions - 图6 Details

Provides additional details, complementing the current content. It is similar to a footnote.