SOURCE

function Color(elem) {
    this.elem = elem;
    this.colors = ['#3498db', '#e67e22', '#1abc9c', '#e74c3c']
    this.run = function () {
        console.log(1);
        setInterval(function () {
            this.elem.style.backgroundColor = this.colors[Math.floor(((this.colors.length) * Math.random()))];
        }.bind(this), 1500);
    }
}
let body = new Color(document.body);
body.run();
body{
    transition: 1.5s;
}
console 命令行工具 X clear

                    
>
console