What is the output of the following function if called with the argument doFun₂?

function doFun₂(n) {
// Enqueue is equivalent to push, Dequeue is equivalent to shift
var q = [];
q.push(0); q.push(1);
for (var i = 0; i < n; i++ ){
var a = q.shift();
var b = q.shift();
q.push(b);
q.push(a + b);
}
return q.pop();
}

Q&A Education