4.
What is the main purpose of JavaScript?
To style web pages
To add interactivity to web pages
To perform server-side tasks
To create databases
Correct: B
JavaScript is primarily used to add interactivity to web pages. It allows developers to create dynamic and interactive elements such as forms, buttons, animations, and event handling. JavaScript is executed in the browser and can manipulate the HTML and CSS of a web page, making it an essential tool for creating modern and interactive websites.