this is a very generic and broad question which you are better off learning from online tutorials. To give you a heads up, JavaScript is a client side language i.e. the language that runs on the browser side when a user opens your website to achieve certain tasks. These tasks could be as simple as showing a pop-up, hiding some control to something a little more complicated like AJAX processing which works asynchronously.
This link[
^] can help you moving forward.
Cheers