Check Divisible JavaScript
if (x & 1)
itsOdd();
else
itsEven();
Stormy Skipper
if (x & 1)
itsOdd();
else
itsEven();
(function() {
/*
* isEven(n)
* @args number n
* @return boolean returns whether the given number is even
*/
jQuery.isEven = function(number) {
return number % 2 == 0;
};
/* isOdd(n)
* @args number n
* @return boolean returns whether the given number is odd
*/
jQuery.isOdd = function(number) {
return !jQuery.isEven(number);
};
})();