How do I figure out if a variable is divisible by 2? Furthermore I need do a function if it is and do a different function if it is not.
You can do it in a better way (up to 50 % faster than modulo operator):
odd: x & 1 even: !(x & 1)
Reference: High Performance JavaScript, 8. ->Bitwise Operators