I have a program that is giving me undefined
because I misdefined my multidimensional array.
In Java I would do it like this:
int[][] array=new int[][] {{1, 2}, {3, 4}};
final int filas = array.length;
final int columnas = array[0].length;
int[][] returnedArray = new int[columnas][filas];
but in javascript I don't know how to do it.
This is what I have tried:
var array=[[1, 2], [3, 4]];
var returnedArray = [[columnas],[filas]];
var returnedArray = [[columnas,filas]];
var returnedArray = [];
but any attempt to fill the indexes of the returnedArray
is failing me.
Thanks in advance.
Assuming you want to create a 2*2 matrix, you can do it like this:
for the particular case the closest thing would be
You can achieve it in the following way;
You can also create an object;