Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/emilwijayasekara/leetcode-2667-create-hello-world-function-30-days-of-javascript-day-1

LeetCode Problem 2667. Create Hello World Function - In this problem we have to write a function createHelloWorld. It should return a new function that always returns "Hello World".
https://github.com/emilwijayasekara/leetcode-2667-create-hello-world-function-30-days-of-javascript-day-1

javascript leetcode leetcode-solutions

Last synced: 2 days ago
JSON representation

LeetCode Problem 2667. Create Hello World Function - In this problem we have to write a function createHelloWorld. It should return a new function that always returns "Hello World".

Awesome Lists containing this project

README

        

# LeetCode (30 Days of JavaScript)

## About the problem
- *Problem Number* : 2667
- *Problem Name* : [Create Hello World Function](https://leetcode.com/problems/create-hello-world-function/)
- *Problem difficulty* : Easy 🟢
- *Programming language used* - JavaScript

## Problem

Write a function createHelloWorld. It should return a new function that always returns "Hello World".

Example 1:
```cpp
Input: args = []
Output: "Hello World"
Explanation:
const f = createHelloWorld();
f(); // "Hello World"
```
The function returned by createHelloWorld should always return "Hello World".`

Example 2:
```cpp
Input: args = [{},null,42]
Output: "Hello World"
Explanation:
const f = createHelloWorld();
f({}, null, 42); // "Hello World"
```
Any arguments could be passed to the function but it should still always return "Hello World".

Constraints:
`0 <= args.length <= 10`

## Approach Explanation
Solved using high order function 👍

### If you have suggestions for improvement or would like to contribute to this solution, feel free to create a pull request. 🙌😇