Hi want to set the timeout funtion for the Freach loop for the callback i am setting the timeout funtion. but its displaying Undifined error. can anybody Explain me here is My code.
function async(array,cb){
array.forEach(function () {
setTimeout(cb,0);
})
}
async([1,2,3,4],function(i){
console.log(i);
});