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 :: how to append an element to an array in javascript 
Javascript :: + sign javascript 
Javascript :: javascript static 
Javascript :: Return with an "IF" Statement 
Javascript :: append array in array 
Javascript :: resize js 
Javascript :: inertia js 
Javascript :: how to add a new line in template literal javascript 
Javascript :: static in javascript 
Javascript :: discord bot not responding to commands 
Javascript :: redux form 
Javascript :: javascript call 
Javascript :: how to add alert on javascript 
Javascript :: query mongodb - nodejs 
Javascript :: js int 
Javascript :: date time react component 
Javascript :: JavaScript finally() method 
Javascript :: pretty print javascript 
Javascript :: pass component as props react 
Javascript :: js for loop 
Javascript :: how to prevent previous radio button active react native 
Javascript :: js string encode decode arabic 
Javascript :: react native get source maps 
Javascript :: javascript program name 
Javascript :: js array to scsv 
Javascript :: mongoose wont update value in array 
Javascript :: storybook absolute paths 
Javascript :: express react docker container example 
Javascript :: styleurls component angular node_modules 
Javascript :: event.target.value inside vf page 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =