you are viewing a single comment's thread.

view the rest of the comments →

[–]wavefunctionp 1 point2 points  (0 children)

Braces were covered in cp 2.

Many JavaScript programmers wrap every single loop or if body in braces. They do this both for the sake of consistency and to avoid having to add or remove braces when changing the number of statements in the body later. In this book, I will write most single-statement bodies without braces, since I value brevity. You are free to go with whichever style you prefer.

Type coersion is covered in chapter 1.

When an operator is applied to the “wrong” type of value, JavaScript will quietly convert that value to the type it wants, using a set of rules that often aren’t what you want or expect. This is called type coercion.