Corrections - JS101: JavaScript for Beginners

Hi, everyone!
This post summarizes the mistakes you have all found in the JS101: JavaScript for Beginners book.

Chapter 5: Meet the Loops (1st edition, page 80 - 81; 2nd edition, page 69)
The code samples for the while loop section is completely wrong. The code for the first block should be:

var count = 0;
        
while (count < 10) {
    document.writeln("looping away!");
 
    count++;
}

The code for the second block is identical to the first except the line containing while is highlighted. This issue will be fixed in the third edition of the book.

Thanks to Neil Satterfield for pointing this out :trophy:

Chapter 12: Numbers (1st edition, page 167; 2nd edition, page 169 - 170)
The code samples for the Infinity and NaN sections are incorrect. The code for Infinity is:

var myLoveForYou = Infinity * 2;

The code for NaN is:

var nope = 1920 / "blah";

Both of these issues will be fixed in the third edition of the book.

Thanks to Neil Satterfield for pointing this issue out as well :trophy:


If you find any additional issues, please feel free to ping me by replying below or by sending me an e-mail to [email protected].

Cheers,
Kirupa :smile: