Answers for "index localstorage object"

0

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);
Posted by: Guest on January-09-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language