Build an app where a user can enter a list of places to eat and then press a button to randomly choose one
Loading...
The last place entered is always chosen
Let me check the current implementation to see what's causing the issue with the random selection.
I can see the random selection logic looks correct, but let me add some debugging to see what's happening. I'll add console logs to track the random selection process.
I've added debugging logs to track the random selection process. Try adding a few restaurants and clicking the "Pick Random Restaurant" button multiple times. Check the browser's developer console (F12) to see the logs and verify if the random index is actually being generated correctly or if there's an issue with the selection logic.
Store the list in local storage