var oddoreven = function (n = false, type = 'odd') {
  var time = !n ? new Date().getDay() : Number(n);

  if (!/^-{0,1}\d+$/.test(time)){
    alert('arguments is not number, please remove quote');
    return;
  }
  hasil = time % 2;
  return hasil == (type == ('odd' || 'ganjil') ? 1 : 0);
}

Test

document.write('isOdd / Ganjil : ' + oddoreven(false, 'odd'));
document.write('<br/>');
document.write('isEven / Genap : '+oddoreven(false, 'even'));

Output

isOdd / Ganjil : true
isEven / Genap : false

https://res.cloudinary.com/dimaslanjaka/image/fetch/https://i.ytimg.com/vi/jFazrvLodrA/maxresdefault.jpg