i did not see this for the quiz game state system and the qa.csv file idea
i prepared for you.
more details please?
again, like the idea that the questions and answers should not be “hard coded”
( better already is to use suggested arrays )
instead treat it as DATA
from a loadable external file ( here spreadsheet type qa.csv )
to a table object.
so yes, modularization can be ( in a second step ) to separate code to several files.
but: the reason can not be that your code is now 3000 lines.
as in times of code folding here p5.js online editor
it is again your problem about (re)-using more own logical functions
just copy 1000 lines outside to a external file actually makes it more difficult to find something.
no, the real reason for using a extra code file should be re usability.
so you have a function /
or a class ( for what it is the pure reason they exist: to be re used )
you want use from several projects you could
download and upload that as a extra file.js.
But to get that running need to declare it in the index.html
( or your browser would not know that it must download it )
to show that better i made a little play code