In urgent need of JS coding help for a new job coding challenge!

Urgent JS coding advice needed for job seeker!

Hey folks,
I have a question and don’t know where to ask it.
I’m a Techdegree grad facing the arduous task of interview coding challenges. I flubbed my first challenge a little, but have made it to round 2 of this particular employers challenge. The challenge is to build a Wordle like game. The it appears as if they want to compare the guessed words to the input received from a JS prompt box. The only way I can think to code this is by actually building a game board and actually capturing the text content to compare values. A nice version of an HTML/CSS/JS version is here:
[https://github.com/ImKennyYip/Wordle/blob/master/wordle.html]

I think the potential employer is asking for a much simpler version. I know how to capture the input from the prompt box, but don’t know how I would evaluate each character to give a user feedback is to the positions as shown below. The senior programmer here stated they wrote a simple version in Ruby to evaluate answers. I really want this job! A nudge in the right direction would be greatly appreciated!!!
Employer’s directions below.

Implement a version of the game Wordle. Here’s how to play.

A player will have 6 chances to guess a 5-letter word. After each
guess, the user will receive feedback that indicates which letters
they guessed correctly and whether or not those letters were in the
correct position. Here’s an example transcript of a game, with notes
added after the double-slashes.

Please guess a 5 letter word. // Just a message.

steal // prompt the user for input, which in this case is “steal”
_ _ e _ _ // “e” is in the correct position, the other letters are unknown
reeds // prompt for input again
(r) _ e _ _ // “r” is in the word, but wrong position
leery
_ _ e r y // three correct letters in the correct positions
query
Great job! // success!

setup an array with the five letters of the target word.
The input would be another array.
loop over the input, if the input value matches the same index in the target - “correct position”
If not then see if the letter is anywhere in the target target.includes(input[i])
if so then “correct in wrong position”
The order of these two checks is important.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.