how to do animation with pure javascript with no html

JavaScript
element.svg.append('rect');
Source

Also in JavaScript: