function helloWorld() { var button = document.getElementById("button"); if (button) { button.onclick = function(){ alert("Witaj, świecie!"); } } }