The main purpose of JavaScript in web browser is to

The main purpose of JavaScript in web browser is to Correct Answer Creating animations and other visual effects

JavaScript can help to facilitate that experience, for example by:
1. Creating animations and other visual effects to subtly guide a user and help with page navigation
2. Sorting the columns of a table to make it easier for a user to find what she needs
3. Hiding certain content and revealing details progressively as the user “drills down” into that content