Creating Javascript SPAs from book examples