Your suggesting, to overwrite by assigning a new value to the variable, will not work (at least not on any JS implementations in use in common browsers). JavaScript strings are immutable, meaning that when you assign a new value to a string variable, a new string is created somewhere on the heap. It does not overwrite the old one. Wrapping it in an object, such as in your second example, does not change this.
The garbage collector in JavaScript is abstracted away, and there is no API for you to interact with it. So you can not directly control what it does or tell it to delete a value from memory at once.
There might be some kind of clever trick/ugly hack that you can try to influence the behaviour of the GC, but I doubt it will be worth the effort. I'd recommend you to think about what threat you are trying to defend against, and consider if it's really a problem for you that the password remains in memory.
Edit: As dandavis correctly highlight in comments, there are JavaScript types that can be overwritten, e.g. typed arrays. However, you still need to get the sensitive data into one of those without it every being stored in an "ordinary" variable. If you just copy it from input.value
you have gained nothing. I don't know how to do that, and honestly, I would not bother trying.