Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.4 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
696655d24b614176d4c9b78d Challenge 170: Odd or Even Day 28 challenge-170

--description--

Given a timestamp (number of milliseconds since the Unix epoch), return:

  • "odd" if the day of the month for that timestamp is odd.
  • "even" if the day of the month for that timestamp is even.

For example, given 1769472000000, a timestamp for January 27th, 2026, return "odd" because the day number (27) is an odd number.

Note: The timestamp is in milliseconds and you should use the date in the UTC timezone, not in your local time.

--hints--

oddOrEvenDay(1769472000000) should return "odd".

assert.equal(oddOrEvenDay(1769472000000), "odd");

oddOrEvenDay(1769444440000) should return "even".

assert.equal(oddOrEvenDay(1769444440000), "even");

oddOrEvenDay(6739456780000) should return "odd".

assert.equal(oddOrEvenDay(6739456780000), "odd");

oddOrEvenDay(1) should return "odd".

assert.equal(oddOrEvenDay(1), "odd");

oddOrEvenDay(86400000) should return "even".

assert.equal(oddOrEvenDay(86400000), "even");

--seed--

--seed-contents--

function oddOrEvenDay(timestamp) {

  return timestamp;
}

--solutions--

function oddOrEvenDay(timestamp) {
  const date = new Date(timestamp);
  const day = date.getUTCDate();

  return day % 2 === 0 ? "even" : "odd";
}