Javascript 如何在addEventListener中实现多个事件?(无jq)

Javascript 如何在addEventListener中实现多个事件?(无jq),javascript,Javascript,我想写在控制台你好世界!每次我单击按钮或按enter键时 这是我的代码: // important vars const btn = document.getElementById('btn'); const input = document.getElementById('input').value; const todoUl = document.createElement("ul"); const todoLi = document.createElement(&qu

我想写在控制台你好世界!每次我单击按钮或按enter键时

这是我的代码:

// important vars 
const btn = document.getElementById('btn');
const input = document.getElementById('input').value;
const todoUl = document.createElement("ul");
const todoLi = document.createElement("li")
const todoList = document.getElementById('todolist'); // this the div that contain ul and li

// this function is for add input value and create list's 
const addTodo = function(){
    
    console.log('hello world!')

    
};

// later ..
btn.addEventListener('click' , addTodo);
btn.addEventListener('submit' , addTodo)
input.addEventListener'keyup',functionev{if ev.keyCode==13{addTodo}这将在输入提示时按enter键调用addTodo提交事件应同时处理click和enter。