You need first to understand Javascript and how to program it.
On my side, when I first started to develop Javascript, my experience was mainly C, C++, Perl and the like.
Due to that background, it quickly occur to me the need in Javascript to be able to query data from the current page (without any redirection) to the web server dynamically. I then discovered the usual key Ajax object XMLHttpRequest.
I would recommend you to use the "regular" Javascript at first, perform some basic dynamic actions, like time display, moving text (...).
Then you could try to implement a simple program that display the clock value from your server. Because XmlHttpRequest perform a dialog between the web server and the client (browser).
For that you need to have access to a web server (eg Apache).
You need to chose what language you will use server side to answer the Xmlhttprequests, e.g. PHP, Perl CGI, etc...
You need to have Apache dispatch the page requests to that PHP ... script.
The script will have to output the result.
Browser-Javascript request
==> Web server (eg PHP)
to Display the clock =
"
Back to browser <==
The the javacript code will get that answer and will have to display that result somewhere.
In terms of Book, Javascript 5 by Flanagan is my first choice.