Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

index localstorage object

const data = [
  {id: 'jijijoj',rating: 'g'}, 
  {id: 'iojiojoi',rating: 'r'}, 
  {id: 'eawfe',rating: 'pg'}, 
  {id: 'ewfewfwe',rating: 'g'}, 
  {id: 'ewfewfew',rating: 'r'}
];

// get index of element with id `iojiojoi`
const index = data.findIndex(item => item.id === 'iojiojoi');

console.log(index);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #index #localstorage #object
ADD COMMENT
Topic
Name
8+4 =