A unique way to showcase JSON data in a table is by utilizing a for loop within a function. This method, however, does not assign an ID or Class to the table.
To hide the final three columns of this table using CSS, the following code can be employed (where (n) signifies the column number):
#divIdName table tr td:nth-child(n) {
display: none; }
#divIdName table th:nth-child(n) {
display: none; }
In an attempt to reveal these hidden columns through JavaScript functions with queryselector, I encountered an issue where only one column was successfully displayed. The content of this lone visible column comprised concatenated headings and first row data from each of the three columns.
If you have insight on how to resolve this problem and ensure all columns are shown correctly, please share your expertise.
UPDATE: I neglected to mention that the showColumnN function includes a condition to verify the presence of a specific string within an array before proceeding with the column revelation process.