First of all, for this challenge, the advanced solutions from “Get Hint” is only advanced in a sense that they use a bit more than the basic JS knowledge. IMO, the advanced solution listed in there is the worst solution out of all. So, don’t use them as a metric to judge what a good code looks like.
(Frankly, “advanced” is an ambiguous term to start with, advanced in what sense?)
Logic wise, your code isn’t complicated. You incrementally compare a portion of the given sequence to a expected sequence. If a term is missing in the given sequence, then it must be different from the expected sequence. So, it is fairly direct.
However, when compared to another candidate, yours simply can’t be simpler. I’ll compare yours with the Basic Solution (which is, in fact, the best one among the three)
Is your code shorter? Nope, it is longer. And, in general, longer code doesn’t make the code any simpler.
(But, don’t try to shorten your code by sacrificing readability)
Does your code read better? Not necessarily. The basic solution only uses the most common programming feature that any programmer can understand. Yours isn’t too bad but have you considered how bad this line reads?
return alphabet.charAt(alphabet.indexOf(str.charAt(0)) + i - 1)
Also, your code is guaranteed to be slower due to multiple calls to
Your code is definitely simpler than the Advanced Solution, but I would still choose the Basic Solution anytime.