Create a Hello World Function Lab

66.4% Acceptance

In this lab, you will be tasked with defining a function called createHelloWorld. This function should return a new function that always returns a string "Hello World" regardless of the arguments passed to it. Use ESM import/export for this lab.

Lab Description

Your main goal is to create a function createHelloWorld which returns another function. The returned function must always return the string "Hello World" when it is called, no matter what arguments are passed to it.

Here are a few examples to help you understand the expected behavior of the createHelloWorld function:

Example 1:

const f = createHelloWorld(); console.log(f()); // Output: "Hello World"

Example 2:

const f = createHelloWorld(); console.log(f("Hi", 123, { a: 1, b: 2 })); // Output: "Hello World"

Example 3:

const f = createHelloWorld(); console.log(f([], [1, 2, 3], 42, null)); // Output: "Hello World"


  • 0 <= args.length <= 10

In order to test your implementation, you will have to create challenges that will import and test the createHelloWorld function. Pay close attention to the Evaluation script and make sure to follow the important rules of building this lab: the final length of the testlog array should be the same as the number of challenges, and the order of evaluation script try-catch blocks must match with the order of challenges written.

Remember to export the createHelloWorld function in the challenge block text for it to be properly imported and tested inside the evaluation script.

Good luck, and happy coding!