To compare 2 values, use comparison operators.
Here's how they work:
val == 0 // val has the value 0 but does not *need* to be the same type ("0" == 0 is true)
val === 0 // val is 0, both in value and type
val != 0 // opposite of "==" - val does not have the value 0
val !== 0 // opposite of "===" - val does not have the value 0, or is not the same type
val > 0 // val is more than 0
val < 0 // val is less than 0
val >= 0 // val is more than or equal to 0
val <= 0 // val is less than or equal to 0
See the difference between ===
and ==
in this question
To implement this in your code, use the ===
operator
if (allsucces === 0) {
// allsucces is equal to 0
}
And be sure allsucces
is a number, not a string, otherwise the strict equals operator will make it return false
!