Quiero la siguiente salida ["a","b"] fuera de bucle, pero no se obtiene. ¿Cómo puedo hacerlo? en lugar de obtener [].
post_with_medias(text, medias) { var listOfIds = [] medias.forEach((element) => { this.upload_media(element).then((res) => { // we can assign alt text to the media, for use by screen readers and // other text-based presentations and interpreters var a = res.data listOfIds.push(a) // returns ["a","b"] }) console.log(a); // this doesnot give the data appended returns [] })