I have about 50 long text strings that I want to filter through 1-5 checkbox categories and then when the user presses “go” it will randomly present the strings to the user one at a time as they press “next”.
I was thinking to use the checkbox input values to make a new array, and then randomly sort this.
I am not sure if I should
- use a JSON file to do this with the categories as objects and then the array for each category as an object,
- or if I should put all the strings into one array and filter it by index (eg category 1 is objects 0-15, category 2 is 16-30 etc).
- Or if I should have multiple arrays that then combine into a new array depending on the checkboxes.
It will be for a mobile experience so I don’t know if that affects the decision making too! And because the strings are about 1-3 sentences long I wasn’t sure if JSON was a better way to store and update that info. Or - does it actually not matter and I should just choose whichever way of working?
I haven’t used JSON before but I have done random sorts on single arrays before. I don’t really want to use anything like jQuery if I don’t have to.
Aucun commentaire:
Enregistrer un commentaire