<button id="btn1">Btn 1</button>
<button id="btn2">Btn 2</button>
const btn1 = document.getElementById('btn1')
const btn2 = document.getElementById('btn2')
btn2.onclick = function() {
alert('click on btn2')
}
btn1.onclick = function() {
btn2.click()
}