javascript - Why does this JS return false for a non-integer? -
here code function - great jquery cycle plugin function calculatetimeout(currelement, nextelement, opts, isforward) { var index = opts.currslide; return index % 2 ? 2000 : false; } i , working fine the last line curious about. "return" kills function , returns ever output has index variable set in above line (is integer) "% 2" divides index var 2 then "? 2000 : false" short hand if else , if statement true / false return either 2000 or false. so 3 return true , 3.5 return false example. so question why in context integer return true non-integer return false? might have thought number return true , 0 return false? guessing due type casting set? thanks