1048. Infinite Method Object
Write a function that returns an infinite-method object.
An infinite-method object is defined as an object that allows you to call any method and it will always return the name of the method.
For example, if you execute obj.abc123(), it will return "abc123".
Example 1:
Input: method = "abc123"
Output: "abc123"
Explanation:
const obj = createInfiniteObject();
obj['abc123'](); // "abc123"
Example 2:
Input: method = ".-qw73n|^2It"
Output: ".-qw73n|^2It"
Now Your Turn!
Pick the correct output for the given inputInput: method = "takeuforward"
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 0 <= method.length <= 1000