- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
function isEven(a) {
a = a. toString(). replace(/[^0-9.]/g, "");
var stack = [];
var rev = a. split(''). reverse();
for (var ix = 0; ix < rev. length; ix++) {
if (rev[ix] == ".") stack. push("dot")
else if (rev[ix] == "1" || rev[ix] == "3" || rev[ix] =="5" || rev[ix] == "7" || rev[ix] == "9")
stack. push ("odd")
else
stack. push('even')
}
var wholenumber = stack. splice(stack. indexof("dot") + 1)
return wholenumber[0] == "even";
}