To get the number of elements in a single dimensional array.
var single_dim_array_with_contents = [ 'control' ,'alt' ,'delete' ];
To get the number of elements in this array : single_dim_array_with_contents.length ;
This function will return 3 from this array.
To get the number of rows and columns in a two dimensional array.
var multi_dim_array_with_contents = [
[ 'mango' , 'orange' , 'banana' ],
[ 'ford' , 'audi' , 'benz' ],
[ 'control' , 'alt' , 'delete' ]
];
To get the number of rows : multi_dim_array_with_contents.length;
This function will return number 3 which is the number of rows.
To get the number of columns in each rows : multi_dim_array_with_contents[i].length ;
' i ' stands for the row number.
var single_dim_array_with_contents = [ 'control' ,'alt' ,'delete' ];
To get the number of elements in this array : single_dim_array_with_contents.length ;
This function will return 3 from this array.
To get the number of rows and columns in a two dimensional array.
var multi_dim_array_with_contents = [
[ 'mango' , 'orange' , 'banana' ],
[ 'ford' , 'audi' , 'benz' ],
[ 'control' , 'alt' , 'delete' ]
];
To get the number of rows : multi_dim_array_with_contents.length;
This function will return number 3 which is the number of rows.
To get the number of columns in each rows : multi_dim_array_with_contents[i].length ;
' i ' stands for the row number.
0 comments: