Mapping, Filtering, and Reducing Things in an Array

This is the happening place to discuss what is going on with `map`, `filter`, and `reduce`: http://www.kirupa.com/html5/arrays_map_filter_reduce.htm :slight_smile:

Hi kirupa!. There’s a typo on the code for the section “The old school way”. I thing it should be:

var names = [“marge”, “homer”, “bart”, “lisa”, “maggie”];
var newNames = [];
for (var i = 0; i < names.length; i++) {
var name = names[i];
var firstLetter = name.charAt(0).toUpperCase();
newNames.push(firstLetter + name.slice(1));
}
console.log(newNames);

Thanks for pointing those mistakes out! It should be fixed now :slight_smile:

var names = ["marge", "homer", "bart", "lisa", "maggie"];

var newNames = [];

for (var i = 0; i < names.length; i++) {
    var name = names[i];
    var firstLetter = name.charAt(0).toUpperCase();
    
    newNames.push(firstLetter + name.slice(1));
}

console.log(newNames);