export function carBtnsMoveActive(boolean) {
const btnStart = document.querySelector('.btn-start')
const btnStop = document.querySelector('.btn-stop')
if (boolean) {
btnStart.disabled = false
btnStart.classList.remove('btn-off')
btnStop.disabled = true
btnStop.classList.add('btn-off')
} else {
btnStart.disabled = true
btnStart.classList.add('btn-off')
btnStop.disabled = false
btnStop.classList.remove('btn-off')
}
}
Hello, can someone help to improve and shrink down this 10 lines of code? I know this, IF can appearance better but i don't have knownledge how to do. I want to write readable code which has less lines. The code works.
I haven't tested this code, but this is my strategy for refactoring your code into something more concise.