Array Map Method

Video

JavaScript Notes

JavaScript
    // Array map( ) method – returns an entirely new Array
    let dwarves = ['Bifur', 'Bofur', 'Bombur', 'Fili', 'Kili', 'Oin', 'Gloin', 'Thorin', 'Balin', 'Dwalin', 'Nori', 'Dori'];
    // determine the length of each name and save it to an array 
    let nameLengths = dwarves.map(function(item, index, array){
        let len = item.length; 
        return len;
    });