You probably want to update this to etcd v3, the commands are quite different.

Thanks, great book!!

OK putting the important bits into a window.onload fixed it

window.onload = function () {
    const searchBox = document.querySelector('#search'); //-> <input>
    const results = document.querySelector('#results'); //-> <ul>

    Rx.Observable.fromEvent(searchBox, 'keyup')
        .debounceTime(1000)
        .pluck('target', 'value')
        .do(query => console.log(`Querying for ${query}...`))
        .map(query => sendRequest(testData, query))
        .subscribe(result => {
            if (result.length === 0) {
                clearResults(results);
            }
            else {
                clearResults(results);
                appendResults(result, results);
            }
        });
};
I can't get listing 4.12 working.
Also, the book listing is different to GitHub.

The error I receive is:
TypeError: Invalid event target


Is that comic sans?
<shudder>
2.12 code just in case someone wants it smilie

const events = require('events');
const net = require('net');
const channel = new events.EventEmitter();
channel.clients = {};
channel.subscriptions = {};
channel.on('join', (id, client) => {
    channel.clients[id] = client;
    channel.subscriptions[id] = (senderId, message) => {
        if (id != senderId) {
            channel.clients[id].write(message);
        }
    };
    channel.on('broadcast', channel.subscriptions[id]);
    channel.on('leave', id => {
        channel.removeListener(
            'broadcast', channel.subscriptions[id]
        );
        channel.emit('broadcast', id, `${id} has left the chatroom.\n`);
    });
});
const server = net.createServer(client => {
    const id = `${client.remoteAddress}:${client.remotePort}`;
    channel.emit('join', id, client);
    client.on('data', data => {
        data = data.toString();
        channel.emit('broadcast', id, data);
    });
    client.on('close', () => {
        channel.emit('leave', id);
    });
});
server.listen(8888);
Wow, that's a big ommision.
Thank you so much for the investigation, that would have taken me ages to work out smilie