dmikester1
dmikester18mo ago

dmikester1 – 04-05 Dec 5

I'm working on the Advent of Code using Node and React. I have my React front end with a button to "Get Answer" which passes an id string. In the backend, I am writing a function for each puzzle. That id string will tell the backend which function to call. There are 2 puzzles per day and 25 days, that is 50 puzzles and thus 50 seperate functions. I would prefer not to write a gigantic if/else or switch statement to determine the correct function to run. Is there a way to dynamically call a function by name?
1 Reply
reactibot
reactibot8mo ago
This thread hasn’t had any activity in 36 hours, so it’s now locked. Threads are closed automatically after 36 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1181446149668868229 Question not getting answered? Maybe it's hard to answer, or maybe you asked at a slow time. Check out these resources for help asking a good question: https://stackoverflow.com/help/how-to-ask http://wp.me/p2oIwo-26