Estoy tratando de devolver el valor itemIDsList pero aparece en la consola como indefinido.
function getAllData() { fetch("JSONitemIDsList.json") .then(response => response.json()) .then(data => { var itemIDsList = data.ids }) return itemIDsList } var itemIDsList = getAllData() console.log(itemIDsList)
Archivo JSON:
{ "ids": [ "sw0001a", "sw0001b", .... ... .. . ]}