slark,
class btn {
constructor(className) {
this.className = className;
this.btn = document.querySelector(className);
this.btn.addEventListener('click', this.btnClick.bind(this));
this.btnClick()
}
btnClick() {
console.log('Привет: ' + this.className)
}
}
let btn1 = new btn('.btn-1')
let btn2 = new btn('.btn-2')