removed redundant initializer from newTitle

This commit is contained in:
tracer 2022-10-26 12:12:34 +02:00
parent 4ed3dcd603
commit 904fd798f6

View File

@ -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')
})