DEV Community

loading...

Discussion on: A JavaScript interview question asked at Facebook

Collapse
bairrada97 profile image
bairrada97

My solution:

const animate = (element, miliseconds, distance) =>{
element.style.transition = all ${miliseconds/1000}s ease;
element.style.transform = translateX(${distance}px) ;

}

animate(document.querySelector('div'), 2000, 100)