filter массивов

Как отфильтровать массивы по часам которые больше 3?

let amount = 100;
let monday = [
  ['Write a tutorial',180],
  ['Some web development',120]
];
let tuesday = [
  ['Keep writing that tutorial',240],
  ['Some more web development',180],
  ['A whole lot of nothing',240]
];

let tasks = [monday,tuesday];

let converted = tasks.map( arr => {
  return arr.map( arr => {
    return [ arr[0], Math.ceil(arr[1]/60) ]
  })
});

console.log(converted);

Ответы (1 шт):

Автор решения: vsemozhebuty

Поправьте, если неправильно понял:

let monday = [
  ['Write a tutorial', 180],
  ['Some web development', 120],
];
let tuesday = [
  ['Keep writing that tutorial', 240],
  ['Some more web development', 180],
  ['A whole lot of nothing', 240],
];

let tasks = [monday, tuesday];

let converted = tasks.map(
  arr => arr.filter(([, minutes]) => minutes > 180)
            .map(([text, minutes]) => [text, Math.ceil(minutes / 60)])
);

console.log(converted);

→ Ссылка