// Dos eventos: entrar y salir
celda.addEventListener('mouseenter', function() {
// cuando el cursor ENTRA
celda.style.background = color }) celda.addEventListener('mouseleave', function()
{
// cuando el cursor SALE
celda.style.background = ''
})
3 teclado
Tecla—
Código—
Caracteres0
⏎ ¡Presionaste Enter!
// 'keydown' se dispara al presionar una tecla
input.addEventListener('keydown', function(evento) {
// evento.key → la tecla ('a', 'Enter', ' '…)// evento.code → código físico ('KeyA', 'Space'…)
tecla.textContent = evento.key })
// 'input' se dispara cada vez que cambia el texto
input.addEventListener('input', function() { longitud.textContent =
input.value.length })