we have an array of the format bugs = ['BD-2', 'SSNC-1', 'SSNC-3', 'RI-2', 'RC-10']
.
You can see it has 4 different bug types/tokens (BD, SSNC, RI and RC) - this could expand in future. The token and ID Number separator can be a '-' or '/' or nothing (E.g: regexp match[-/]?) ie, the array can be
= ['BD-2', 'SSNC-1', 'SSNC-3', 'RI-2', 'RC-10'] or
= ['BD-2', 'SSNC/1', 'SSNC-3', 'RI-2', 'RC/10'] or
= ['BD-2', 'SSNC-1', 'SSNC3', 'RI-2', 'RC10']
Now trying to build a Simple JavaScript function which can categorize the elements into separate arrays based on token type and then output a simple HTML table with bugtoken type as column headers.
For an array of bugs = ['BD-2', 'SSNC-1', 'SSNC-3', 'RI-2', 'RC-10']
.`
Output should look like:
___________________________________
| BD SSNC RI RC |
|------+---------+--------+---------+
|BD-2 | SSNC-1, | RI-2 | RC-10 |
| | SSNC-3 | | |
|______|_________|________|_________|