Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

at in js

const array1 = [5, 12, 8, 130, 44];

let index = 2;

console.log(`Using an index of ${index} the item returned is ${array1.at(index)}`);
// expected output: "Using an index of 2 the item returned is 8"

index = -2;

console.log(`Using an index of ${index} item returned is ${array1.at(index)}`);
// expected output: "Using an index of -2 item returned is 130"
Comment

PREVIOUS NEXT
Code Example
Javascript :: determine if touch screen js 
Javascript :: split array into chunks javascript 
Javascript :: chunk an array 
Javascript :: variable for every user discord.js 
Javascript :: bind an event to dom element angular 
Javascript :: how to play audio in javascript 
Javascript :: set cookie using nest js 
Javascript :: open modal useState 
Javascript :: store images in mongoose 
Javascript :: reactjs node sass incompatible with ^4.0.0 ^5.0.0 
Javascript :: how to convert seaconds into hh:mm:ss in javascript 
Javascript :: reactjs join two array 
Javascript :: dockerfile 
Javascript :: react-active link 
Javascript :: javascript whitespace strip 
Javascript :: remove duplicates multidimensional array javascript 
Javascript :: js get node index 
Javascript :: getmilliseconds javascript 
Javascript :: disable button using jquery 
Javascript :: AsyncStorage.getItem undefined is not an object 
Javascript :: remove object in array javascript 
Javascript :: regex data 
Javascript :: using html forms to define javascript variables 
Javascript :: primitive data types in javascript 
Javascript :: debounce 
Javascript :: countdown javascript 
Javascript :: jquery: select select box rpogramatically 
Javascript :: js if else statement one line 
Javascript :: looping queryselectorall 
Javascript :: jquery use variable in string "without" concatenate 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =