Please note that, all the conditional operators are always going to return a boolean value.
A true, if the condition satisfies, and a false if it doesn't.
Now consider the above code snippet that you have provided i.e.:
return newArr.length > 0;
What you can add in the above code snippet is something like this:
return Array.isArray(newArr) && newArr.length > 0;
The above line of code is going to return a boolean value as well, after all 'AND' operator is being used.
In addition to the above point, this can be a way to apply validation in the function as well. Consider some user to pass an integer as newArray instead of an Array.
Because of this scenario the expression Array.isArray(newArr) will be evaluated to false, and hence the next expression i.e. newArr.length isn't going to get executed thus, you save your day.
So this is how placement of conditions can matter.
return (newArr.length > 0);, now you can see you're returning abooleanvalue.lengthofnewArris greater than0returntrue, otherwise it will returnfalse