From 01362715b97a58b33987e61205b559fd338b3ba0 Mon Sep 17 00:00:00 2001
From: david
Date: Mon, 7 Apr 2025 20:27:59 -0700
Subject: [PATCH] add keys + cap
---
js/load.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/js/load.js b/js/load.js
index a13548e..e2cabe0 100644
--- a/js/load.js
+++ b/js/load.js
@@ -9,6 +9,10 @@ const loadSection = (sectionName) =>{
.catch(error => console.error('Error loading JSON:', error));
}
+function cap(str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ }
+
// Recursive function to handle strings, arrays, and objects
const renderItems = (items) => {
return items.map(item => {
@@ -18,8 +22,8 @@ const renderItems = (items) => {
return renderItems(item); // recurse into nested array
} else if (typeof item === 'object') {
return `${Object.entries(item).map(([key, value]) =>
- `${value}`).join('
')}
`;
- // `${key}: ${value}`).join('
')}
`;
+ // `${value}`).join('
')}`;
+ `${cap(key)}: ${value}`).join('
')}`;
} else {
return `${String(item)}
`;
}