How does js encapsulate data reasonably?

problem description: the front interface is a table. Clicking on the cell will return the custom data data on the cell and the corresponding cell line number.
is as follows:
Line number: 0Jing 2Jue 1
data:a,xy,xyz

requirements:
how to effectively encapsulate data? (deduplicated data remains unique) for example:

0 a,d,g,b,j
1 xd,ef,tg,sd

tables are suitable for data in two-dimensional array format, like this:

 

I don't quite understand what you mean by this effective encapsulation.

what you want to ask is how to remove the weight of the array?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31f46-2bdcb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31f46-2bdcb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?