// 常规函数:hello = function() { document.getElementById("demo").innerHTML += this;} // window 窗口对象调用函数: window.addEventListener("load", hello); // 一个 button 按钮对象调用函数: document.getElementById("btn").addEventListener("click", hello); 亲自试一试 » 实例...
Arrow Function With Parameters: hello = (val) =>"Hello "+ val; Try it Yourself » In fact, if you have only one parameter, you can skip the parentheses as well: Arrow Function Without Parentheses: hello = val =>"Hello "+ val; ...