Skip to content

Instantly share code, notes, and snippets.

@EncodeTheCode
Created February 19, 2026 10:22
Show Gist options
  • Select an option

  • Save EncodeTheCode/a631ba041f9c65e1e7994651fedae97b to your computer and use it in GitHub Desktop.

Select an option

Save EncodeTheCode/a631ba041f9c65e1e7994651fedae97b to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Array → Table</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
body{font-family:system-ui,Arial;background:#f4f6f8;padding:18px}
.card{background:#fff;border-radius:8px;padding:10px;margin:12px 0;box-shadow:0 6px 18px rgba(0,0,0,.05)}
table{width:100%;border-collapse:collapse}
th,td{padding:8px;border-bottom:1px solid #eee;text-align:left}
th{background:#f0f4f8}
tr:nth-child(even){background:#fafafa}
.title{font-weight:600;margin-bottom:6px;padding:0.5em 0.5em;}
.bg1{background-color: #E4A1E544;}
</style>
</head>
<body>
<div id="sony_created" class="card"></div>
<div id="sony_published" class="card"></div>
<script>
const info_header=["Game Title","Game ID","Serial","Release Date"];
const sony_created=[
["Crash Bandicoot","SCES-00344","SCES-00344","1996-11-15"],
["Croc 2","SCES-01003","SCES-01003","1999-06-25"],
["Syphon Filter","SCES-01914","SCES-01914","1999-07-09"]
];
const sony_published=[
["Crash Bandicoot 2","SCES-00967","SCES-00967","1997-11-14"],
["Croc: Legend of the Gobbos","SCES-00601","SCES-00601","1997-10-10"],
["Syphon Filter 2","SCES-02169","SCES-02169","2000-03-17"]
];
function render(c,d,h,t){
if(!d?.length) return $(c).empty();
const $c=$(c).empty();
if(t) $c.append($('<div>').addClass('title bg1').text(t));
const $t=$('<table>').append('<thead><tr></tr></thead><tbody></tbody>');
h.forEach(x=>$t.find('thead tr').append($('<th>').text(x)));
d.forEach(r=>{
const $tr=$('<tr>');
r.forEach(v=>$tr.append($('<td>').text(v)));
$t.find('tbody').append($tr);
});
$c.append($t);
}
$(function(){
render('#sony_created',sony_created,info_header,'Sony Created Games');
render('#sony_published',sony_published,info_header,'Sony Published Games');
});
</script>
</body>
</html>v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment