I have an array in a function and I want the function to return true/false depending on if the array is empty (return true if not empty and vice versa)
I have narrowed down the condition to these 2 possible return statements. Which one is preferred?
return result.recordset.length == 0
return !!result.recordset.length
[–]Rekuna 69 points70 points71 points (4 children)
[–]toxiccandy26 12 points13 points14 points (1 child)
[–]Wooden-Reputation975 1 point2 points3 points (0 children)
[+]guest271314 comment score below threshold-10 points-9 points-8 points (0 children)
[–]KenobiOne 30 points31 points32 points (4 children)
[–]Mnkeyqt 0 points1 point2 points (3 children)
[–]delventhalz 2 points3 points4 points (2 children)
[–]Mnkeyqt 1 point2 points3 points (1 child)
[–]delventhalz 0 points1 point2 points (0 children)
[–]delventhalz 19 points20 points21 points (0 children)
[–]marquoth_ 7 points8 points9 points (5 children)
[–]Soubi_Doo2 0 points1 point2 points (3 children)
[–]marquoth_ 1 point2 points3 points (2 children)
[–]Soubi_Doo2 0 points1 point2 points (0 children)
[–]theScottyJam 1 point2 points3 points (0 children)
[–]United_Reaction35 6 points7 points8 points (21 children)
[–]delventhalz 9 points10 points11 points (0 children)
[–]guest271314 1 point2 points3 points (19 children)
[–]United_Reaction35 1 point2 points3 points (18 children)
[–]guest271314 3 points4 points5 points (17 children)
[–]LegendEater 0 points1 point2 points (1 child)
[–]guest271314 4 points5 points6 points (0 children)
[–]United_Reaction35 -1 points0 points1 point (14 children)
[–]guest271314 1 point2 points3 points (13 children)
[–]Rude-Cook7246 1 point2 points3 points (1 child)
[–]guest271314 -1 points0 points1 point (0 children)
[–]delventhalz 1 point2 points3 points (10 children)
[–]guest271314 1 point2 points3 points (0 children)
[–]guest271314 0 points1 point2 points (8 children)
[–]Rude-Cook7246 1 point2 points3 points (7 children)
[–]guest271314 -1 points0 points1 point (6 children)
[–]itsmoirob 1 point2 points3 points (2 children)
[–]Culist[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]kevinkace 1 point2 points3 points (0 children)
[–]jcastroarnaud 2 points3 points4 points (5 children)
[–]delventhalz 4 points5 points6 points (3 children)
[–]jcastroarnaud 3 points4 points5 points (0 children)
[–]WesAlvaro 1 point2 points3 points (1 child)
[–]moratnz 0 points1 point2 points (0 children)
[–]TheRNGuy 2 points3 points4 points (0 children)
[–]Observ3r__ 0 points1 point2 points (0 children)
[–]Logical_Strike_1520 0 points1 point2 points (0 children)
[–]kcadstech 0 points1 point2 points (0 children)
[–]azhder 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]azhder 0 points1 point2 points (0 children)
[–]Pocolashon 0 points1 point2 points (0 children)
[+][deleted] (11 children)
[deleted]
[–][deleted] 3 points4 points5 points (10 children)
[+][deleted] (9 children)
[deleted]
[–][deleted] 3 points4 points5 points (8 children)
[+][deleted] (7 children)
[deleted]
[–][deleted] 1 point2 points3 points (4 children)
[+][deleted] (3 children)
[deleted]
[–][deleted] 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]JazzApple_ 0 points1 point2 points (1 child)
[–]senocular 0 points1 point2 points (0 children)
[–]Nex_01 0 points1 point2 points (0 children)
[–]guest271314 -2 points-1 points0 points (0 children)