With an input of a 2 dimensions array I need to get as output an array with the elements in uppercase.
This is my try, but it doesn't works.
var cityColumn = [['avila'], ['burgos'], ['madrid'], ['sevilla']];
var cityRow = [['avila', 'avila', 'burgos', 'madrid', 'sevilla']];
var cityCell = [['sevilla']];
console.log(cityRow);
function upperCaseArray(myArray) {
var upperized = myArray.map(function(city){
console.log(typeof city);
return city.toUpperCase();
});
return upperized;
}
console.log(upperCaseArray(cityColumn));
console.log(upperCaseArray(cityRow));
console.log(upperCaseArray(cityCell));
// output desired:
// [['AVILA], ['BURGOS'], ['MADRID'], ['SEVILLA']]
// [['AVILA, 'AVILA', 'BURGOS', 'MADRID', SEVILLA']]
// [['SEVILLA']]
Note: thesee inputs are that I've get from a Google Sheet range SpreadsheetApp.getActiveSpreadsheet().getSelection().getActiveRange().getValues(). I'm starting coding Google Apps Script.