Assignment
Assignment
A: EVENTS.
Events in JavaScript are actions or occurrences that happen in the browser, triggered by user
movements, and page loading. JavaScript code can respond to these events by executing
<html>
<head>
<title>Event Example</title>
</head>
<body>
document.getElementById("myButton").addEventListener("click", function() {
alert("Button clicked!");
});
</script>
</body>
</html>
B: EVENT HANDLER.
actions or system events. It executes code in response, enabling dynamic and interactive
2: OBJECTS.
Objects in JavaScript are composite data types used to store related data and functionality. They
consist of key-value pairs where keys are strings (properties) and values can be any data type or
species: "Dog",
age: 5,
sound: "Woof",
speak: function() {
console.log(this.sound);
In these examples, the first one defines An animal object using an object literal, containing