javascript foreach async function