3

Given a 2D array, a[m][n] where m,n > 0, how do I access specific portions of that array (as I would in Matlab or Python, for example):

a[2:5][3:]

I realize that the slice() command works for one dimensional arrays but I can't get it to do what I want with higher dimensions.

Is this (easily) possible within Javascript?

sdasdadas
  • 23,917
  • 20
  • 63
  • 148

1 Answers1

5
a.slice(2,3).map(function(m) {return m.slice(3);});

Assumes relatively up-to-date browser and/or shim.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592