From d44a9338efb2d33a82845d46a0eed4046ab0d18c Mon Sep 17 00:00:00 2001 From: Nico Bakomihalis Date: Fri, 25 Oct 2024 15:50:56 -0500 Subject: [PATCH] adding logging --- node-parents-children/app.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/node-parents-children/app.js b/node-parents-children/app.js index b1b4b9b..d6ba464 100644 --- a/node-parents-children/app.js +++ b/node-parents-children/app.js @@ -34,14 +34,15 @@ function renderPage(mapped) { } -function renderList(element, nodes){ - clearList(element); - console.log(nodes); +function renderList(listElement, nodes){ + console.log("list element", listElement); + clearList(listElement); + console.log("nodes", nodes); } -function clearList(list) { - while (list.firstChild) { - list.removeChild(list.firstChild); +function clearList(listElement) { + while (listElement?.firstChild) { + listElement.removeChild(listElement.firstChild); } }