Happy New Year 2024

Happy New Year 2024

Post Date : 2023-12-31T18:25:50+07:00

Modified Date : 2023-12-31T18:25:50+07:00

Category: cheatsheet

Tags: well-being

#!/usr/bin/env node

const words = ["Happy", "New", "Year", "2024"];
const message = {};
words.map((w, index) => {
  Reflect.set(message, index, w);
});

let happyNewYearMessage2024 = "";
Reflect.ownKeys(message)
  .sort()
  .forEach((index) => {
    happyNewYearMessage2024 = `${happyNewYearMessage2024} ${Reflect.get(
      message,
      index
    )}`;
  });

console.log(happyNewYearMessage2024);