<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
}
#square{
width: 100px;
height: 100px;
background-color: #fac;
position: absolute;
left: 50px;
top: 50px;
}
</style>
</head>
<body>
<div id="square"></div>
<script>
const square = document.getElementById("square");
function move() {
if (square.offsetLeft>700){
return;
}
square.style.left = square.offsetLeft + 10 + 'px';
requestAnimationFrame(move);
}
move();
</script>
</body>
</html>