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
  • 4,196
  • 1
  • 19
  • 40

1 Answers1

3

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

const map1 = [wrangeValues[0].map(x => (x === 1 ? 'y' : 'n'))]
TheMaster
  • 45,448
  • 6
  • 62
  • 85