Д
Size: a a a
Д
Д
VV
RM
checkBalance = async (tokensData) => {Вызов функции
// loop tokens obj
tokensData.forEach(async (item) => {
const curInput = item.amount // input
const curBalance = await getBalanceByAddress(item.address) // get user balance by a certain token address
// log
console.log(parseFloat(curInput), parseFloat(curBalance)
// compare
if(parseFloat(curInput) > parseFloat(curBalance))
return false
})
return true
}
const isEnoughBalance = await this.checkBalance(this.state.tokensData)Почему всегда возвращается true, даже когда log показывает что должно быть false ???
A
RM
VD
checkBalance = async (tokensData) => {Вызов функции
// loop tokens obj
tokensData.forEach(async (item) => {
const curInput = item.amount // input
const curBalance = await getBalanceByAddress(item.address) // get user balance by a certain token address
// log
console.log(parseFloat(curInput), parseFloat(curBalance)
// compare
if(parseFloat(curInput) > parseFloat(curBalance))
return false
})
return true
}
const isEnoughBalance = await this.checkBalance(this.state.tokensData)Почему всегда возвращается true, даже когда log показывает что должно быть false ???
RM
А
MV
А
Кm
Кm
А
А
Кm
I
Кm
DK
DK