Last active
August 31, 2018 03:05
-
-
Save minkcv/345366242578dc5f86c0987157f43f99 to your computer and use it in GitHub Desktop.
Probably the absolute worst code I have ever written. 8/29/18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is probably the absolute worst code I have ever written. 8/29/18 | |
| var data = [ | |
| ['AAAAAA', 'BBBBBB', 'CCCCCC'], | |
| ['a', 'a', 'c'], | |
| ['a', 'a', 'c'], | |
| ['a', 'a', 'c'], | |
| ['a', 'a', 'c'] | |
| ]; | |
| var html = ` | |
| <div id='data-component'> | |
| <table class='data-table'> | |
| `; | |
| html +=` | |
| <thead> | |
| <tr> | |
| `; | |
| for (var i = 0; i < data[0].length; i++) { | |
| html +=` | |
| <th><pre>` + data[0][i] + `</pre></th> | |
| `; | |
| } | |
| html +=` | |
| </tr> | |
| </thead> | |
| <tbody> | |
| `; | |
| for (var i = 1; i < data.length; i++) { | |
| html += ` <tr>` | |
| for (var j = 0; j < data[i].length; j++) { | |
| html +=` | |
| <td><pre>` + data[i][j] + `</pre></td> | |
| `; | |
| } | |
| html += ` </tr>` | |
| } | |
| html += ` | |
| </tbody> | |
| </table> | |
| </div> | |
| `; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Revised to remove extraneous html attributes. The focus of the gist is to illustrate messiness of the js and html interaction.