See also https://changelog.com/jsparty/171
on click from #some-btn
log 'The button was clicked'
end
However, we really lean towards directly embedding the scripts on HTML elements for Locality of Behaviour https://htmx.org/essays/locality-of-behaviour/I'm confident the examples given can be simplified as well. The vanilla JS and jQuery examples are not equivalent for example, the vanilla one is (intentionally?) inline JS whereas the jquery one separates it out.
It also doesn't use ES6 arrow functions (neither vanilla nor native), which would remove the need to rebind `this` to `self`.
The vanilla one also sets style via JS, which isn't how you should do things. Transitions can be set in CSS beforehand. The one used sets the animation to 'all' properties as well, instead of just 'opacity' which is the only property changed.
TL;DR the article is making vanilla look more difficult than it is. The jquery example seems lifted off of Stack Overflow.