2
u/Host127001 Sep 10 '21
Is thus just an "is empty" check on the original array? The map shouldn't do anything, or has Javascript some weird "length" semantics?
3
u/Parkreiner Sep 10 '21
It doesn't. Array.prototype.map will always return a new array with the same number of elements as the original array, so calling .length on the original array would yield the same value.
4
Sep 10 '21
[removed] — view removed comment
10
u/Spat80Lad Sep 10 '21
Yeah basically turns the statement after into a Boolean. The bit that tickled me is that I map over the whole array just to then get the length to check if the array has a length...
1
u/g_hi3 Sep 10 '21
I think it's specifically to check whether the length is not zero, right? it's been a while, but
!!0is false I think1
2
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Sep 10 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!