Binding names may not contain spaces, yet it is often helpful to use multiple words to clearly describe what the binding represents. These are pretty much your choices for writing a binding name with several words in it: fuzzylittleturtle
In a few cases, such as the Number function, the first letter of a binding is also capitalized. This was done to mark this function as a constructor. What a constructor is will become clear in Chapter 6. For now, the important thing is not to be bothered by this apparent lack of consistency.
Often, raw code does not convey all the information you want a program to convey to human readers, or it conveys it in such a cryptic way that people might not understand it. At other times, you might just want to include some related thoughts as part of your program. This is what comments are for.
let accountBalance = calculateBalance(account);
// It’s a green hollow where a river sings accountBalance.adjust();
// Madly catching white tatters in the grass. let report = new Report();
// Where the sun on the proud mountain rings: addToReport(accountBalance, report);
// It’s a little valley, foaming like light in a glass.
A // comment goes only to the end of the line. A section of text between /* and */ will be ignored in its entirety, regardless of whether it contains line breaks. This is useful for adding blocks of information about a file or a chunk of program.
I first found this number scrawled on the back of an old notebook.
Since then, it has often dropped by, showing up in phone numbers and the serial numbers of products that I’ve bought.
It obviously likes me, so I’ve decided to keep it.
const myNumber = 11213;
No Starch Press; 3rd edition.