@Danny-Engelman
Online since 1990
Nothing here yet.
Nothing here yet.
No blogs yet.
FP: Don't do a SPACE for a letter match, but a false value, so its easier to test in the 2nd loop function word2colors(answer = "dread", guess = "added") { answer = answer.split(""); return guess .split("") .map((letter, idx) => letter == answer[idx] ? (answer[idx] = false) : letter ) .map((letter, idx) => letter ? (idx = answer.indexOf(letter)) < 0 ? "GRAY" : (answer[idx] = "YELLOW") : "GREEN" ); // ['YELLOW', 'YELLOW', 'GRAY', 'YELLOW', 'GREEN'] } console.log(word2colors()); FYI, why built a clone at all? You can use the Web Components of the original Wordle