x) !== (b > x); } To me it l...">

JSLint gives strange message "strange attitude"

I have a form code:

function test(a,b,x) {
    return (a > x) !== (b > x);
}

      

To me it looks like a logical piece of code, but JSLint complains about the "Weird relationship" message.

So firstly, does anyone know why JSLint is complaining? And secondly, is there a way to somehow disable the "Weird relationship" error?

+3


source to share


1 answer


For some reason JSLInt sees the left side and the same as the right side.

To avoid this, you need to split it into variables



function test(a, b, x) {
    "use strict";
    var t1 = a > x,
        t2 = b > x;
    return t1 !== t2;
}

      

+1


source







All Articles