I have an JSON file which contains a property named dateOfBirth and most of objects have different format (for example: one has 1.9.2012, and the other one has 02.04.1929). I wrote a function that changes the dates format to be the same in every single object, but I fail at connecting it to the array. What am I doing wrong? How can it be fixed? It has to be done in pure Javascript, without jQuery or any frameworks.
const endpoint = 'https://api.myjson.com/bins/agowj';
const people = [];
fetch(endpoint)
    .then(blob => blob.json())
    .then(data => people.push(...data));
people.dateOfBirth.forEach(function(elem) {
    var newtab = [];
    elem.split("-").forEach(function(elemi) {
        if (elemi.length === 1) {
            newtab.push("0" + elemi);
        } else {
            newtab.push(elemi);
        }
    })
    console.log(newtab.join("-"));
}) 
    