This is the statement in question, how it should (and does) read:

`x < y ? -1 : x > y ? 1 : 0`

Can someone help me understand the expression:

return x y ? 1 : 0;

Is this saying

if ( x y ) {

result = 1

}

else ( x = y ) {

result = 0

}

Is this correct?

Cheers,

Rob

The code is available here: http://www.dweebd.com/javascript/binary-search-an-array-in-javascript/

]]>Thanks!

]]>`sort`

method is the only way. Simple rules can do great things.I’m a JavaScript noob so this article is some kind of a gold mine to me.

Thanks, James! ]]>