function loadStrings(file){ var strings = []; fetch(file). then(response => response.text()). then(data => strings = data.split("\n")). then(printStrings(strings)); } function printStrings(strings){ console.log(strings.length); for(string of strings){ console.log(string); } } En este ejemplo, console.log(strings.length) imprime cero. Pensé que adjuntar un then() después de asignar strings aseguraría que las strings se escribieran antes de intentar imprimirlas. ¿Cómo puedo asegurarme de que están escritos antes de trabajar con ellos?