JavaScript Challenge: What would be your solution to this challenge? 🥷🏻🧩

Renan Ferro - Apr 11 - - Dev Community

Hey folks. how are you today?!

Today I saw a cool and interesting JavaScript challenge and thought I'd bring it to our community too!

Soo...

Image description


The Challenge 🕵️‍♂️

The expected result for the challenge will be something like below:

🎯 Expected Output:

{
  CJS: "This is the original Node.js module system, used since its first versions."
}
Enter fullscreen mode Exit fullscreen mode

And also the base code is to start solving the challenge as below:

🎯 Base Code:

function getCorrectDescription(patternName) { 
    let patterns = { 
        ESM: "This is a more modern modularization pattern, officially introduced in newer versions of Node.js.", 
        CJS: "This is the original Node.js module system, used since its first versions.", 
        AMD: "AAMD is a modularization standard associated with JavaScript development for the browser.",
    };

    return ?;
 }
Enter fullscreen mode Exit fullscreen mode

A little cool, right?!

When I saw this challenge I thought it was really cool and I needed to take some time to apply it and finish it.

And you, what would be your proposed solution?! Leave it in the comments, let's share and see different ways of solving

See you 😄😁

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .