mardi 8 septembre 2020

Design Pattern for JavaScript Loops to Simplify things

I am parsing through some data in work using a loop and regex to pick certain lines and either put the lines in an array or create a tab and then adding the contents of the array after.

I think its overcomplicated as during one loop trying to decipher each line while either putting in an array or creating a heading tab and then adding the contents of the array seems a lot.

Im just looking for a few tips or pointers as im thinking of taking it all apart and separating the arrays against making tabs and divs. Im stuck though without doing complicated multi-d arrays to know which array is meant for which tab.

Is it feasible to stop the loop, move out of it to create a tab or div and move back in again if an array is filled to a certain point in the data?

As it is script for my work, it is kind of sensitive, hence no code being put up here. I will try to explain as best I can if anyone would like to help.

Aucun commentaire:

Enregistrer un commentaire