为什么我运行的时候报错 style属性不存在!
Uncaught TypeError: Cannot read property 'style' of undefined
at promise.html:60
function promiseAnimate(ball, distance) { return new Promise(function(resolve, reject) { function _animate(ball, distance, cb) { setTimeout(function() { var marginLeft = parseInt( ball.style.marginLeft , 10) if (marginLeft === distance) { resolve() } else { if (marginLeft < distance) { marginLeft++ } else { marginLeft-- } ball.style.marginLeft = marginLeft + 'px' _animate() } }, 13) } _animate() }) }