У меня небольшая проблема, и я не могу найти решение,
У меня есть эта маленькая функция здесь:
Clicked(){
for (let i = 0; i < 5; i++) {
if (this.ShareProvider.ValueFonction(i)) {
alert(i)
}
}
}
Там 6 кнопок, и я пытаюсь сделать, когда я нажимаю кнопку, запускается функция alert()
. Проблема в том, что когда я запускаю программу, она показывает 6 предупреждений подряд.
Я пытался написать по-другому, но та же проблема.
if (this.ShareProvider.ValueFonction(1)) {
alert(1)
}
if (this.ShareProvider.ValueFonction(2)) {
alert(2)
}
if (this.ShareProvider.ValueFonction(3)) {
alert(3)
}
if (this.ShareProvider.ValueFonction(4)) {
alert(4)
}
if (this.ShareProvider.ValueFonction(5)) {
alert(5)
}
if (this.ShareProvider.ValueFonction(6)) {
alert(6)
}
или
if (this.ShareProvider.ValueFonction(1)) {
alert(1)
}
if (this.ShareProvider.ValueFonction(2)) {
alert(2)
}
if (this.ShareProvider.ValueFonction(3)) {
alert(3)
}
if (this.ShareProvider.ValueFonction(4)) {
alert(4)
}
if (this.ShareProvider.ValueFonction(5)) {
alert(5)
}
if (this.ShareProvider.ValueFonction(6)) {
alert(6)
}
Спасибо за внимание