<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
const fib = [1,2,3,5,8,13]
for(var i = 0; i < fib.length; i++){
(function(j){
setTimeout(function() {
console.log(`fib[${i}] = ${fib[i]}`)
},1500)
})(i)
}
</script>
</body>
</html> |