Quiz: Pressing Enter

Pressing Enter in the field should add the note to the list, but nothing happens. Click the line with the mistake.

const noteInput = document.querySelector("#note");
const noteList = document.querySelector("#notes");

noteInput.addEventListener("keydown", function (event) {
    if (event.key === "enter") {
        const item = document.createElement("li");
        item.textContent = noteInput.value;
        noteList.append(item);
        noteInput.value = "";
    }
});

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

Back

7/10

Next