removed redundant initializer from newTitle
This commit is contained in:
parent
4ed3dcd603
commit
904fd798f6
|
@ -76,6 +76,7 @@ function deleteAddress(id) {
|
||||||
function upCase(text) {
|
function upCase(text) {
|
||||||
return text[0].toUpperCase() + text.substring(1);
|
return text[0].toUpperCase() + text.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortBy(column) {
|
function sortBy(column) {
|
||||||
// clear titles
|
// clear titles
|
||||||
const titles = ['first', 'last', 'street', 'zip', 'city', 'phone']
|
const titles = ['first', 'last', 'street', 'zip', 'city', 'phone']
|
||||||
|
@ -88,7 +89,7 @@ function sortBy(column) {
|
||||||
let currentTitleElement = document.getElementById(column)
|
let currentTitleElement = document.getElementById(column)
|
||||||
let currentTitle = currentTitleElement.innerHTML
|
let currentTitle = currentTitleElement.innerHTML
|
||||||
|
|
||||||
let newTitle = ''
|
let newTitle
|
||||||
if (currentSortOrder.innerHTML === 'asc') {
|
if (currentSortOrder.innerHTML === 'asc') {
|
||||||
currentSortOrder.innerHTML = 'desc'
|
currentSortOrder.innerHTML = 'desc'
|
||||||
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇'
|
newTitle = currentTitle[0] + currentTitle.substring(1) + ' ⬇'
|
||||||
|
@ -130,3 +131,8 @@ function sortBy(column) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
console.log('loaded')
|
||||||
|
sortBy('last')
|
||||||
|
})
|
Loading…
Reference in New Issue