divisible check javascript 1

divisible check javascript

if (x & 1)
 itsOdd();
else
 itsEven();

Here is what the above code is Doing:
1. It’s taking the value of x and storing it in a temporary variable.
2. It’s then checking if the value of the temporary variable is odd or even.
3. If it’s odd, it calls itsOdd().
4. If it’s even, it calls itsEven().

Similar Posts