Menu
I want result:
“first”
“second”
“third” – after delay of 1s
“`
function first() {
console.log(“first”);
}
function second(a, callback) {
callback(a);
console.log(a);
}
function third(b, secCallBack) {
secCallBack(b);
console.log(b);
second(“second”, function () {});
}
setTimeout(third, 1000)
third(“third”, first);
Where am i wrong ?
``<i>
</i><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>called back list</title>
<script>
function first(callBack){
console.log('number one');
setTimeout(function(){(callBack.shift())(callBack)},1000);
}
function second(callBack){
console.log('number two');
setTimeout(function(){(callBack.shift())(callBack)},1000);
}
function third(){
console.log('number three')
}
var callBackFunctions = [second,third];
first(callBackFunctions);
</script><i>
</i>
`</CODE>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one'); <br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<CODE>
`<i>
</i>
`</CODE>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000); <br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000); <br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script><!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script><br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script><br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<!DOCTYPE html><br/>
<html lang="en">if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script><br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script>if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script><br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script>
<CODE>
`<i>
</i>
`</CODE>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script><br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>sequenced</title><br/>
<script><br/>
function first(){<br/>
console.log('number one');<br/>
}<br/>
function second(){<br/>
console.log('number two');<br/>
}<br/>
function third(){<br/>
console.log('number three');<br/>
}
function sequencer(order){<br/>
if(order.length){<br/>
setTimeout('sequencer(order)',1000);<br/>
(order.shift())()};<br/>
}<br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script><br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script>
<CODE>
`<i>
</i>
</script><i>
</i>
`</CODE>
</script><br/>
order=[first,second,third];<br/>
sequencer(order);<br/>
</script>
<!DOCTYPE html><br/>
<html lang="en"><br/>
<head><br/>
<meta charset="UTF-8"><br/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><br/>
<title>called back list</title>
<script>
function first(callBack){<br/>
console.log('number one');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function second(callBack){<br/>
console.log('number two');<br/>
setTimeout(function(){(callBack.shift())(callBack)},1000);<br/>
}<br/>
function third(){<br/>
console.log('number three')<br/>
}<br/>
var callBackFunctions = [second,third];<br/>
first(callBackFunctions);
</script>
<CODE>
`<i>
</i>
``
``<i>
</i><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>called back list</title>
<script>
function first(callBack){
console.log('number one');
setTimeout(function(){(callBack.shift())(callBack)},1000);
}
function second(callBack){
console.log('number two');
setTimeout(function(){(callBack.shift())(callBack)},1000);
}
function third(){
console.log('number three')
}
var callBackFunctions = [second,third];
first(callBackFunctions);
</script><i>
</i>
``
0.1.9 — BETA 5.6