DISCLAIMER: This is part of a lab assignment for school
Update: I want to keep this for reference in the future, so I will just delete the code portion. Thanks to everyone who helped! You were a big help
Assignment (Sum of it): Create a celebrity photo guessing game in HTML/JS using an array of 30 celebrity objects.
Current State: I'm at the part where the users guess gets checked. The users guess is called in function checkUserGuess()
. If it matches, then I call displayOutPut("correct")
or ("incorrect")
as a parameter for the next function, function displayOutput(result)
. It takes the result
parameter and checks it in the switch statement. For the sake of argument, the code I'm concerned about is in the "incorrect" case rather than "correct" since I don't know majority of these celebrities faces. I purposely get it incorrect for testing purposes.
(Celebrity randomly chosen: Charlie Chaplin)
Observation: (Per my screenshot) It seems that the celebrity array already has Charlie removed, although its reading in console that the Array has a size of 30. This is before I splice
Charlie out of the array. The washedupCelebs
array did receive Charlie. And, the third array shows the celebrity array with Charlie removed and the size changed to 29.
Screenshot: https://i.stack.imgur.com/prtHk.png
Whats being console.log in order:
randomCelebrity
objectcelebrities
array before removing the used celebrity- the index of the current celebrity
washedupCelebs
array to store the used celebritiescelebrities
array after removing the current celebrity
Questions: Is there a reason that Charlie is removed before the splice
takes place? Should I be concerned about this? I feel like its not a big deal, but I would rather get some opinions about it so I can move on. The functionality seems to work properly, but it looks like its bugged in some way.
Notes: - The off-chance a fellow classmate sees this post, I don't want them stealing my code. I will delete this post after a few hours as well for that same reason. - One more thing, I know my professor is a moderator on here so if you're seeing this, I'd be more than happy to delete it and email you personally about it. Not sure if you'd mind me doing this, seeing I'm not asking anybody to actually do the assignment for me.
Code:
REMOVED FOR POTENTIAL COPYING