Hello guys,
I would like to do something seemingly simple: find out if an
element in an array that is passed to my function exists.
I used to think I could just do: if (arr[i]) ...
However, if this element's value happens to be 0, the conditional
will return false, even though the element actually exists.
Any ideas? Can you check if the element == null?
- Noah
I would like to do something seemingly simple: find out if an
element in an array that is passed to my function exists.
I used to think I could just do: if (arr[i]) ...
However, if this element's value happens to be 0, the conditional
will return false, even though the element actually exists.
Any ideas? Can you check if the element == null?
- Noah
Comment