How does JS simplify such a cycle

JavaScript
the following code, except for the different conditions of judgment, is the same in the loop. The judgment condition may contain I , or it may not contain I . Is there any way to simplify them?

// obj json
loop1(){
    for(let i=0;i<obj.length;iPP){
        if(i%2!==0){
            doSomethingA()
        } else {
            doSomethingB()
        }
    }
}
loop2(){
    for(let i=0;i<obj.length;iPP){
        if(i%2!==0 && i!==0){
            doSomethingA()
        } else {
            doSomethingB()
        }
    }
}
loop3()
loop4()
Mar.16,2021

// obj = xxxx

function loop (predicate) {
    for (let i = 0; i < obj.length; iPP) {
        if (predicate(i)) {
            doSomethingA()
        } else {
            doSomethingB()
        }
    }
}

loop(i => i % 2 !== 0)
loop(i => i % 2 !== 0 && i !== 0)


let loop = (fun) => {<br> obj.forEach((v, k) => {

if (fun) {
} else {
}

})
}
loop (fun)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eac546-20c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eac546-20c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?