From 904fd798f6e07a813283809cc625153177229d9c Mon Sep 17 00:00:00 2001 From: tracer Date: Wed, 26 Oct 2022 12:12:34 +0200 Subject: [PATCH] removed redundant initializer from newTitle --- public/assets/js/functions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/assets/js/functions.js b/public/assets/js/functions.js index 9f21fae..b98e5b8 100644 --- a/public/assets/js/functions.js +++ b/public/assets/js/functions.js @@ -76,6 +76,7 @@ function deleteAddress(id) { function upCase(text) { return text[0].toUpperCase() + text.substring(1); } + function sortBy(column) { // clear titles const titles = ['first', 'last', 'street', 'zip', 'city', 'phone'] @@ -88,7 +89,7 @@ function sortBy(column) { let currentTitleElement = document.getElementById(column) let currentTitle = currentTitleElement.innerHTML - let newTitle = '' + let newTitle if (currentSortOrder.innerHTML === 'asc') { currentSortOrder.innerHTML = 'desc' newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇' @@ -130,3 +131,8 @@ function sortBy(column) { } } } + +document.addEventListener('DOMContentLoaded', () => { + console.log('loaded') + sortBy('last') +}) \ No newline at end of file