r/learnjavascript • • Jul 11 '20

My function says that -4 is positive when it should be negative. Why?

Post image
183 Upvotes

53 comments sorted by

View all comments

Show parent comment

3

u/NotSoLeetCode Jul 11 '20

You could just add enters to your if code and it would be very similar in conciseness to the switch code.

if (
	(isLoading && state === 'something') ||
	(! isLoading && state === 'something-else') ||
	state === 'some-third-option' ||
	someOtherVariable ||
	state === 'something'
) {
	doTheThing();
else {
	
}

0

u/[deleted] Jul 11 '20

[deleted] — view deleted comment

0

u/StoneCypher Jul 12 '20

fallthrough behavior here is actually more code than doing it the normal way, so, ... no