Debugging and Optimizing Repeated Conditions #485
Unanswered
Jonny-T-cyber
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Just a quick first input: For the repeated part, you could use a function, and check what element did trigger the action. I'm not able to take a closer look right now. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good morning, everyone,
I’ve written the following code, but it’s not working as expected:
I specify that:
Here is the exact text of the errors:
0:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
I’d like to ask for your help with the following:
Is the provided code free of errors, or does it have any issues?
I want to ensure it’s both syntactically and functionally correct. Also because in the complete listing there are other pieces of code that are written in the same way with different entities.
How can I optimize the code to avoid repeating the same condition five times?
I tried storing the result of the condition evaluation in a variable and reusing it later, but I couldn’t get it to work. Is there an effective way to achieve this without introducing errors?
What could be the causes of the errors that appear in the console, which seem to occur almost randomly?
Thank you in advance to anyone willing to help
Beta Was this translation helpful? Give feedback.
All reactions