I have an object that looks like this
obj = [ {name: 'john', address:'123 whateverdr'}, {name: 'james', address:'123 whateverdr'}, {name: 'tom brady', address:'123 whateverdr'}]
I need to change the name to title case John or in the 3rd item Tom Brady needs to be title case;
Is there a one liner way that this can be done in typescript? The below doesnt work as it says obj.map is not a function
obj.map(d => d[0].toUpperCase() + d.substr(1));
var wordArr = obj.map(m => m.split(" "));
var newArr = wordArr.map(function (word) {
word = word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
obj = newArr;
});
}