function Color(elem) {
this.elem = elem
this.Colors = ['#1abc9a', '#4ddbac', '#ccc9a9', '#6ab39a', '#5cdc9a']
this.run = function () {
setInterval(function () {
let i = Math.floor(Math.random()*this.Colors.length)
// console.log(i) 随机数
this.elem.style.backgroundColor = this.Colors[i] //改变颜色
}.bind(this)
, 1000)
}
}
let obj = new Color(document.body)
obj.run()