text: module.exports = function towelSort (matrix) {
    let arr = [];
    let flag = true;
    if (matrix === undefined) return [];
    for (let i = 0; i < matrix.length; i++)
    {
      for (let j = 0; j < matrix[i].length; j++)
      {
        if (flag) arr.push(matrix[i][j]);
        else arr.push(matrix[i][matrix[i].length - j - 1])
      }
      if (flag) flag = false;
      else flag = true; 
    }
    return arr;
  }
  