I know that the solution to my problem is the promises but I can't understand at all how to apply it to what I want to do ... Can you help me without referring me to the courses on promises in javascript?
thx you
function getPosition (workers) {
    let counter = 0
    let allResult = []
    _.forEach(workers, (n) => {
        let firstname = n.firstname
        let lastname = n.lastname
        let streetname = n.address.streetname
        let city = n.address.city
        let country = n.address.country
        axios.get('https://api-adresse.data.gouv.fr/search/?q=' + streetname + ' ' + city)
            .then(response => {
                let lon = response.data.features[0].geometry.coordinates[0]
                let lat = response.data.features[0].geometry.coordinates[1]
                let finalResult = {
                    firstname: firstname,
                    lastname: lastname,
                    address: {streetname: streetname, country: country, city: city, lon: lon, lat: lat}
                }
                logger.info('Longitude and latitude was found for ' + firstname + ' ' + lastname)
                counter++
                allResult.push(finalResult)
                if (counter === workers.length) {
                    return(allResult)
                }
            })
            .catch(error => {
                logger.error(error)
            })
    })
}I just want to return 'allresult' ... thanks for your help
 
    