text: 
  // You should implement your task here.
  
  module.exports = function towelSort (matrix) {
    if (!matrix) {
      return [];
    }
  
    let newArr = [];
    for ( let i = 0; i < matrix.length; i++ ) {
      for ( let j = 0; j < matrix[i].length; j++) {
        let row = i % 2 === 0 
          ? j
          : (matrix[i].length - 1 - j);
          newArr.push(matrix[i][row]);
      } 
    }
    return newArr;
  }
  