Using this JavaScript:
function test1() { console.log('Test 1'); }
function test2() { console.log('Test 2'); }
const button = document.getElementById('button');
button.onclick = function() { test1(); }
button.onclick = function() { test2(); }
and this HTML
<button id="button">RGB</button>
When I click on the button, only "Test 2" is displayed in the console.
Why is this the case? Why aren't both functions executed?