var input = document.createElement('input'); input.type = "text"; document.getElementById('answer-5258595').appendChild(input); var a = ['1', 2222, {x:3}, [4,6,7], ['lol', 'hui']]; for (var i = 0, len = a.length; i < len; i++) { var fn = function(index) { input.value = a[index]; }; fn = fn.bind(window, i); setTimeout(fn, 100 + i * 5000); }
As you can see, objects convert into '[object Object]', and arrays convert into string which consists of their elements joined by ',' (without space).