I have two images with the same band names (imageA and imageB) and I am going to merge them into a single image. I need to add a character that identifies the name of the bands (for example, B2_medianA and B2_medianB for imageA and imageB). It's really a lot of bands.
I've created a function that adds the letter 'A' to a list, however I can't do it to the list of bands. Below is the script.
// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')
.select(['B11', 'B8', 'B3']);
var listBands = img.bandNames();
print(listBands);
var funtionA = function(list){
return list + 'A';
};
var listBandsR = listBands.map(funtionA);
print(listBandsR);
// This example works
var arr = ['first', 'second', 'third'];
var arr2 = arr.map(funtionA);
print(arr);
print(arr2);
When I run it for the list of bands (listBands) it adds the value 'A' but to what appears to be the object's properties, not its value. Any suggestion to solve it?