Skip to main content Accessibility Feedback

← Back to the Vanilla JS Academy


This is powered by a DOM manipulation library you’ll create that can be easily customized by developers like this.

// Listen for custom counter:increase-before events
// Stop counting once you reach 20
document.addEventListener('counter:increase-before', function (event) {
	if (event.detail.count > 19) {
		alert(`You've reached the max allowed.`);

// Create a new counter
let count = new Counter('#app', {
	buttonText: 'Increase By 1',
	start: 10