SOURCE

function a(){
    setTimeout(function(){
        console.log(1)
    },0)
    new Promise(res=>{
        console.log(2)
        res()
          console.log(3)
    }).then(()=>{
         console.log(4)
    })
    console.log(5)
}

function b(arr){
if(arr.length<2){
    return 0
}else{
    let arrNew = arr.sort((a,b)=>{
        return a-b
    })
    console.log(arrNew)
    let maxCha = 0
    for(let i = 0;i<arrNew.length-1;i++){
        let cha = Math.abs(arrNew[i] - arrNew[i+1])
        maxCha = maxCha>cha?maxCha:cha
    }
    return maxCha
}
}
let arr = [0,3,5,4,5,1,8]
console.log(b(arr))

console 命令行工具 X clear

                    
>
console