Events များသည် user actions (click, mouse over, key press) သို့မဟုတ် browser actions (page load) များဖြစ်သည်။ addEventListener() method ဖြင့် event တစ်ခုဖြစ်ပေါ်လာလျှင် run ရန် function တစ်ခုကို သတ်မှတ်နိုင်သည်။
javascript
// Assume HTML: <button id="myBtn">Click Me</button>
const button = document.getElementById("myBtn");
// button.addEventListener("click", function() {
// alert("Button was clicked!");
// });
console.log("Click the button on the page to see the event.");You should see
(Button ကိုနှိပ်လိုက်လျှင် 'Button was clicked!' alert box ပေါ်လာမည်)