lib/Create Two Dimensional Array.js
// program to create a two dimensional array
program to create a two dimensional array
program to create a two dimensional array
function twoDimensionArray(a, b) {
    let arr = [];
    for (let i = 0; i< a; i++) {
        for(let j = 0; j< b; j++) {
            arr[i] = [];
        }
    }
    for (let i = 0; i< a; i++) {
        for(let j = 0; j< b; j++) {
            arr[i][j] = j;
        }
    }
    return arr;
}
function twoDimensionArray ( a , b ) { let arr = [ ] ; for ( let i = 0 ; i < a ; i ++ ) { for ( let j = 0 ; j < b ; j ++ ) { arr [ i ] = [ ] ; } } for ( let i = 0 ; i < a ; i ++ ) { for ( let j = 0 ; j < b ; j ++ ) { arr [ i ] [ j ] = j ; } } return arr ; }
program to create a two dimensional array
program to create a two dimensional array
// creating two dimensional array // inserting elements to array