text: 
  // You should implement your task here.
  
  function itemSort(item, index) {
      if (index % 2 == 0) return item.sort((a, b) => a - b);
      if (index % 2 != 0) return item.sort((a, b) => b - a);
  }
  module.exports = function towelSort (matrix) {
      
      let result = [];
      if (matrix === undefined) return result;
      
      return result.concat(...matrix.map(itemSort));;
  }
  