0

I have the following array

const wrangeValues = sheet.getRange(workdayFlagRow, firstColumn, 1, lastColumn).getValues();

which displays in the log as [[1.0, 0.0, 0.0, 0.0, 0.0, 1.0]]

I want to create a new array with Ys or Ns like this:

const map1 = wrangeValues.map(x => (x === 1 ? 'y' : 'n'));

Logger.log(map1) outputs as [n]

Expected output: [[y, n, n, n, n, y]]

redditor
  • 3,830
  • 1
  • 18
  • 38

1 Answers1

3

wrangeValues is a 2D array. See here. Use:

const map1 = [wrangeValues[0].map(x => (x === 1 ? 'y' : 'n'))]
TheMaster
  • 37,620
  • 6
  • 43
  • 68