JSLint is complaining that (true)
is a weird condition
. Which is understandable if I wasn't using it on a reversed switch statement. So is JSLint wrong or should I not be using reversed switch statements?
Thanks for any help/enlightenment.
switch (true) {
case (menuLinksLength < 4):
numberOfColumns = 1;
break;
case (menuLinksLength > 3 && menuLinksLength < 7):
numberOfColumns = 2;
break;
case (menuLinksLength > 6 && menuLinksLength < 10):
numberOfColumns = 3;
break;
case (menuLinksLength > 9):
numberOfColumns = 4;
break;
default:
numberOfColumns = 0;
}
switch(true===true)
. This is not an endorsement of the practice ;) – Whelanswitch(true===true)
doesn't help, as that then causes it to complain about a "Weird relation." – Stalag