JavaScript 1 - Module 2

Lesson Task 3 Questions

Question 1

Convert the following following code to use the addEventListener method:

const btn = document.querySelector(".btn");

btn.onclick = function () {
    console.log("I'm a button");
};

Question 2

Add a click event using addEventListener to the second button.

In the event's function, display the character count from the input in the b.count element.

Make sure to remove all trailing and leading spaces (spaces at the beginning and end of the input's value).