var newlist = list.slice( 0, pos ).concat( tasks ).concat( list.slice( pos ) );
This makes me shudder just looking at it.
var newlist = list.slice( 0, pos ).concat( tasks ).concat( list.slice( pos ) );
This makes me shudder just looking at it.
If you didn't want to modify the original array, you can shorten yours a little like this:
var newlist = list.slice(0,pos).concat(tasks,list.slice(pos));
Your method is as good as any- you'd have to splice each member of your second array individually.
var list=[1,2,3,4,5,6,7,8,9], tasks= ['a','b','c'], pos=3;
while(tasks.length ) list.splice(pos,0,tasks.pop());
alert(list.join('\n'))
/* returned value:
1
2
3
a
b
c
4
5
6
7
8
9
*/