Implement the new Keyword

Implement myNew(Constructor, ...args) that replicates the exact behavior of the new keyword.

When you write new Foo(a, b), JavaScript does four things:

  1. Creates a plain object {}
  2. Sets its [[Prototype]] to Foo.prototype
  3. Calls Foo with this = the new object and the provided arguments
  4. Returns the object — unless the constructor explicitly returns a different object
function Person(name) {
  this.name = name;
}
Person.prototype.greet = function() { return `Hi, I'm ${this.name}`; };

const alice = myNew(Person, "Alice");
alice.greet();           // "Hi, I'm Alice"
alice instanceof Person; // true
Examples
Input: ["basic","Alice",30]
Output: "Alice:30"
Hints

Implement the new Keyword

Implement myNew(Constructor, ...args) that replicates what the `new` keyword does — creating an object, setting its prototype, running the constructor, and returning the right value.