let dataList = {};
fetch('https://api.hh.ru/areas/113').then( response=> {
return response.json();
}).then(
json=> {
dataList = json;
json.areas.forEach( area =>{
/* var opt = document.createElement('option');
opt.value = area.id;
opt.innerHTML = area.name;
billing_area.appendChild(opt); */
console.log(area.name)
});
}
);
let dataList = {};
fetch('https://api.hh.ru/areas/113').then(response => {
return response.json();
}).then(
json => {
const cities = json.areas.reduce((array, area) => {
const citiesAtArea = area.areas.reduce((citiesArray, city) => {
return [...citiesArray, city.name]
}, [])
return [...array, ...citiesAtArea]
}, [])
console.log(cities)
}
);