Work with legacy and simple sites using jQuery selectors, events, AJAX, effects, and plugins.
Lessons
Run a handler only the first time an event fires.
one() for Single-Use Handlers is easiest to learn by reading the example, changing it, and observing the result.
function handleClick() {
console.log('clicked');
}
$('#btn').on('click', handleClick); // attach
$('#btn').off('click', handleClick); // remove
$('#once').one('click', () => console.log('runs only once'));
$('#btn').trigger('click'); // fire programmaticallyPractice the one() for Single-Use Handlers example in a small scratch file, then explain what changed and why.