Store an empty array in tasks to see that its length is 0.
tasks
0
Make sure to assemble var tasks = []; in your code.
var tasks = [];