带条件的 GAS 地图数组

GAS map array with conditions

我有以下数组

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

在日志中显示为 [[1.0, 0.0, 0.0, 0.0, 0.0, 1.0]]

我想像这样用 Ys 或 Ns 创建一个新数组:

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

Logger.log(map1) 输出为 [n]

预期输出:[[y, n, n, n, n, y]]

wrangeValues 是一个二维数组。参见 here。使用:

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