The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

abergquist (181) [Avatar] Offline
#1
WRT p. 58 (p. 62 of the .PDF), I read the following:

In node.js, the aptly-named global object global, is available to you in every program you run.


But then Listing 3.2 reads as follows:

Listing 3.2 Discovering global objects
// `This` will refer to the global object
console.log(Object.keys(this)); ?
// How many keys are there on the global object?
console.log(Object.keys(window).length)
// in node.js
console.log(Object.keys(global).length)
? Object.keys() will return an object's own enumerable properties as an array. Using this on this will let you see all
of the properties that exist on the global object but aren’t directly visible to you.


As a reader, this makes me ask: is the global object called "global" or is it called "Object"? That is the question!
mark (60) [Avatar] Offline
#2
Will def. clear this up — thanks for posting! smilie