Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to read 2 dimensional array in javascript


        
            
        
     activities.forEach((activity) => {
    activity.forEach((data) => {
        console.log(data);
    });
});
Comment

multi dimensional array javascript

//2D array
let activities = [
    ['Work', 9],
    ['Eat', 1],
    ['Commute', 2],
    ['Play Game', 1],
    ['Sleep', 7]
];
Comment

multi-dimensional array js

var array = [
  ["0, 0", "1, 0", "2, 0", "3, 0", "4, 0"],
  ["0, 1", "1, 1", "2, 1", "3, 1", "4, 1"],
  ["0, 2", "1, 2", "2, 2", "3, 2", "4, 2"],
  ["0, 3", "1, 3", "2, 3", "3, 3", "4, 3"],
  ["0, 4", "1, 4", "2, 4", "3, 4", "4, 4"],
  ]; // Think of it as coordinates, array[x, y] x = 0; y = 0; is "0, 0" on 
	// this grid

console.log(array[3][3]); // returns "3, 3"
// If you use graphics (ex: p5js or JS Canvas) then this will be a 5x5 map.
// Useful for roguelikes and/or raycasters.
Comment

PREVIOUS NEXT
Code Example
Javascript :: windows cmd horizontal line 
Javascript :: object inside object javascript 
Javascript :: javascript Using Math.min() on an Array 
Javascript :: how to numbers by checked in checkbox in javascript 
Javascript :: clear interval e.close is not a function 
Javascript :: react typed js 
Javascript :: Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax. 
Javascript :: react form submit 
Javascript :: upload file in react 
Javascript :: how to install yup in react native 
Javascript :: node exporter service 
Javascript :: access session data from ejs view 
Javascript :: how to print to screen in javascript 
Javascript :: iso to date javascript 
Javascript :: return elemnt from array 
Javascript :: MongoNotConnectedError: Client must be connected before running operations 
Javascript :: javascript clear input string 
Javascript :: typeorm config 
Javascript :: jquery select input with class 
Javascript :: jqiery check if scroll to end 
Javascript :: js php number format 
Javascript :: add onclick event jquery button 
Javascript :: Min-Stack Optimized Solution Via JS 
Javascript :: ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @agm/core@1.1.0 npm ERR! Found: @angular/common@10.0.14 
Javascript :: Function used to reload the portion of a page using javascript 
Javascript :: reduce array to object javascript 
Javascript :: javascript null true or false 
Javascript :: debounchow use input debounce in javascript vue.js 
Javascript :: how to select div js 
Javascript :: node mysql 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =