I try to add string string element to array using map as follows, but the code do not work. What's wrong there?
function towerBuilder(nFloors) {
let towerArray = [];
towerArray.length = nFloors;
let arrItem = '*' + ' ';
let newArr = towerArray.map(function(item, i) {
let n = 2 * i + 1;
item = arrItem.repeat(n);
return item;
});
}