small medium large xlarge

Kuma_pancake_pragsmall
27 Jan 2014, 04:06
Phil Hadviger (1 post)

Hi,

On page 52 and 53 you use Array.prototype.slice.call(null, arguments) in all of the methods.

For me this results in “TypeError: Array.prototype.slice called on null or undefined” no on node.js 0.10.x with or w/o –harmony passed in.

Array.prototype.slice.call(arguments) seems to work for me, but I was curious if I’m misunderstanding something or doing something wrong that is causing me to see this error. I’m still somewhat new to JS, and therefore wanted to confirm.

Outside of this, the book has been amazing so far.

Generic-user-small
30 Jan 2014, 00:14
Steven Harris (4 posts)

I had the same experience? Typo or are we misunderstanding?

Generic-user-small
17 Mar 2014, 00:47
Ivan johns (2 posts)

Try:

router.on('message', function() {
	let frames = Array.apply(null, arguments);
	dealer.send(frames);
});

dealer.on('message', function() {
	let frames = Array.apply(null, arguments);
	router.send(frames);
});
Generic-user-small
13 Apr 2014, 19:50
Christophe Leroy (2 posts)

Got the same problem - but on top of that IPC are not working on Windows 7 for 0MQ. I am using tcp://127.0.0.1:9999 instead of ipc://filer-read.ipc … It was breaking on Array.prototype.slice.call … but it works with Ivan’s suggestion (Array.apply(null, arguments)).

Avatar_pragsmall
26 May 2014, 11:19
Jim R. Wilson (69 posts)

This is a typo and I should fix it. I originally had Array.apply(null, arguments) and meant to change it to Array.prototype.slice.call(arguments).

  You must be logged in to comment