343960 (2) [Avatar] Offline
#1
I am also following along and got stuck in the console testing parts 5.14 and 5.17. I haven't used google chrome console before, but the book implies that if you type in what's printed in bold, you should get back what is in italics. But it doesn't work that way. In 5.17 for example, I have typed in each line as it shows in the book and hit return after every semi-colon. When I type

peopleDb().each(function(person, idx) {console.log(person.name);});

I get back

Object {extend: undefined, filter: function, order: function, limit: function, start: function…}

instead of a list of the people names like it shows in the book.What is wrong?
michael.mikowski (247) [Avatar] Offline
#2
343960 wrote:I am also following along and got stuck in the console testing parts 5.14 and 5.17. I haven't used google chrome console before, but the book implies that if you type in what's printed in bold, you should get back what is in italics. But it doesn't work that way. In 5.17 for example, I have typed in each line as it shows in the book and hit return after every semi-colon. When I type

peopleDb().each(function(person, idx) {console.log(person.name);});

I get back

Object {extend: undefined, filter: function, order: function, limit: function, start: function…}

instead of a list of the people names like it shows in the book.What is wrong?


The most common cause of such a problem is when people use libraries that do not match those used in the book.

Please ensure you use the source code from http://manning.com/mikowski/ and download, uncompress it, change to the section of your listing, and dereference the links so:

wget http://www.manning-source.com/books/mikowski/listings_spwajse2e.tgz
tar xvzf listings_spwajse2e.tgz
cd listings_spwajse2e_2013-09-11/ch05_06
cp -aL 5.4.2 5.4.2_d # dereferences links
google-chrome 5.4.2_d/spa.html


If you don't want that hassle of dereferencing, the best solution is to simply put the source code in your public html path and view it from your web server where the symbolic links work just fine.

I just checked, and this worked exactly as described in the book. You may want to compare your code with the provided source to see where the problem lies.