Javascript Array printMatrix()

Description

Javascript Array printMatrix()

Array.prototype.printMatrix = function() {
  let return_string = '';
  for (row of this) {
    return_string += '[';
    return_string += row.join(', ');
    return_string += "] \n";
  }/*from  w  w w .  jav a  2 s  .c  o  m*/
  console.log(return_string);
}



PreviousNext

Related