completed isWordGuessed function