JS is about behaviors that cannot be replicated using CSS. For instance, CSS cannot validate a web form. For that we need script that can target a form control and examine the user input for that control. It can manipulate the DOM to display error messages to the user and disable the SUBMIT button until such repairs are made.
We can use JS to suppress and display any part of a web page in response to a users interaction. That is why we say that JS adds interactivity to an otherwise static document, keeping in mind that CSS offers some of the same, with limitations that need to be learned.
Today’s web is anything but static. A web page without interactivity is rather a rare thing, these days. JS helps to gather information about the user agent and tailor responses to that UI. It can help to make decisions about which response to give to which user inputs or interaction.
Script can be used to write and modify a style sheet, write and modify page text, write and modify cookies, write and obfuscate email addresses so spam bots can’t find them, but the user can. We haven’t really put more than scratch up to this point of the complete range of script possibilities. The bottom line is scripting has and always will be how we give our pages and apps their horse-power and versatility.