js initialize 2d array
let data = [];
for (let row=0; row<rows; row++) {
data.push(new Array(cols).fill('#'));
};function makeArray(w, h, val) {
var arr = [];
for(let i = 0; i < h; i++) {
arr[i] = [];
for(let j = 0; j < w; j++) {
arr[i][j] = val;
}
}
return arr;
}
Also in JavaScript:
- material css
- lootie file in react
- how to use hooks react
- how to create react app in vs code
- js cookie
- on change jquery
- var let const javascript
- model to js
- what is .eslint.js in vue
- rest api with mongodb and nodejs
- nodejs await inside map
- import switch material ui
- hide warnings in expo app
- data-dismiss= modal in jquery
- redirect in react
- send mail node js
- delete backspace on string js
- react native mac
- node stdin read char by char
- Unsupported engine { package: '[email protected]', required: { node: '~0.10' }, current: { node: 'v12.18.3', npm: '7.0.15' } }
- javascript use variable regex
- push values to state array class react
- html define javascript variable
- how to refresh a web page automatically in javascript