I have a constuctor function and a button. I want to get a name of one client in each click. but when I click one time, I get the name of all the clients in a sequence.
function Client(Name, Feedback) {
this.clientName = Name;
this.clientFeedback = Feedback;
}
let clients = [
new Client('Jo', 'hi'),
new Client('Mark', 'bye'),
]
let btnRight = document.getElementById('btnRight');
btnRight.addEventListener('click', () => {
for (let Client of clients) {
console.log(`${Client.clientName} says ${Client.clientFeedback}!`)
}
})
<button class="btn" id="btnRight">button</button>
I'm absolute beginner, so any feedback will help me