Andreich1310,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.test{
font-size: 36px;
}
</style>
</head>
<body>
<div class="test"></div>
<script>
document.addEventListener("DOMContentLoaded", function() {
var arr = [0, 1, [20, 21, 22, 23], 3, [40, [410, 411], 42], 5],
parent = document.querySelector(".test"),
k = [0];
function fn() {
for (var b = arr, a = 0; a < k.length; a++) b = b[k[a]];
void 0 == b ? (k.pop(), k.length && k[k.length - 1]++ && fn()) : window.setTimeout(function() {
var a = document.createElement("div");
a.appendChild(document.createTextNode(b));
parent.appendChild(a);
a.style.marginLeft = 40 * (k.length - 1) + "px";
"object" == typeof b ? k.push(0) : k[k.length - 1]++;
fn()
}, 800)
};
fn()
});
</script>
</body>
</html>