I was asked this question by a big company. To my knowledge strings in JS are immutable. Hence, I can't do that. I was wondering if I am missing something. The interview was adamant not to create another var (string, array) and do it in-place.
input: 'harry'
output: 'hary'
I had to apologize and insist that I must create an array out of it and do the operations on it or create another empty string and push wanted chars to it.
Did I ruin my interview?