Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js access array in array

let nestedArray = [
	[
		"salmon",
		"halibut",
	],
	[
		"coral",
		"reef",
	]
];

nestedArray[1][0];//just add another index number
Comment

JavaScript Access Elements of an Array

const myArray = ['h', 'e', 'l', 'l', 'o'];

// first element
console.log(myArray[0]);  // "h"

// second element
console.log(myArray[1]); // "e"
Comment

JavaScript Access Elements of an Array

let x = [
['Jack', 24],
['Sara', 23], 
['Peter', 24]
];

// access the first item 
console.log(x[0]); // ["Jack", 24]

// access the first item of the first inner array
console.log(x[0][0]); // Jack

// access the second item of the third inner array
console.log(x[2][1]); // 24
Comment

PREVIOUS NEXT
Code Example
Javascript :: encrypt js 
Javascript :: react: fow to use find(to get the id of a element 
Javascript :: removing duplicates from array javascript 
Javascript :: convert integer month to string month react native 
Javascript :: find object from list 
Javascript :: how to go to last page after authentication 
Javascript :: for loop js 
Javascript :: radio button not checked 
Javascript :: Add array to formData react js 
Javascript :: js tostring 
Javascript :: check if property exists javascript 
Javascript :: js if text contains lowercase 
Javascript :: .select js 
Javascript :: Sort() functions 
Javascript :: min max value javascript 
Javascript :: ordenar numeros array javascript 
Javascript :: javascript double question mark 
Javascript :: make table responsive react-bootstrap-table2 
Javascript :: jquery form validation 
Javascript :: javascript escape character 
Javascript :: javascript strftime 
Javascript :: how i do button when click open a new tab in react 
Javascript :: Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state. 
Javascript :: moment js 
Javascript :: useroutes how to use 
Javascript :: sails disable grunt 
Javascript :: js rename onclick function 
Javascript :: how to remove last character from string in javascript 
Javascript :: google scripts urlfetchapp hearders and body 
Javascript :: exceljs font family 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =