creating 2d array in javascript
// declaration of a two-dimensional array
// 5 is the number of rows and 4 is the number of columns.
const matrix = new Array(5).fill(0).map(() => new Array(4).fill(0));
console.log(matrix[0][0]); // 0
//example of two dimensional array
var grid = [
["a", "b"],
["c", "d"],
["e", "f"]
];
console.log(grid[0][0]); // a
console.log(grid[1][1]); // d
console.log(grid);var [r, c] = [5, 5];
var m = Array(r).fill().map(()=>Array(c).fill(0));
Also in JavaScript:
- fs.readfile
- how to use if else inside jsx in react
- node map has value
- how to multiple loop in javascript using for
- how to remove 000webhost watermark 2019
- what are callbacks
- scrollview not working react-native
- set attribute javascript background image
- vue js error mixed spaces and tabs no-mixed-spaces-and-tabs
- Module not found: Can't resolve '@date-io/date-fns' in 'C:\Users\61455\Documents\React apps\mya2o\src\pages'
- js trim out input white space
- default props react
- remove curly brackets from stringify javascript
- javascript detect textarea change
- how can auto download window print in javascript
- angular email validation
- regular expression
- redirect through javascript
- fibonacci sums javascript
- mat-drawer angular "10"
- javascript find prime number
- how to create my own filter in js
- javascript last element of array
- see if array contains array javascript