'How to remove multiple array from a oject with index of item from array in Jacascript/Jquery Object?

I have arrayItems on following format:

​Remove elements from in Javascript/jQuery

{images: Array(4) [ "abcd.png", "bcd.jpg", "def.jpg", … ]
​
itemIds: Array(4) [ "1", "3", "2", … ]}

var revid=$(this).attr('data'); 

Above images and itemIds are stored on storedNames by parsing JSONfrom localstorage.

revid returns any values which is on itemIds

This is giving me not a function error:

var indexed = storedNames.findIndex(item => item.itemIds === 'revid');

1 ) How can I find the indexof itemIds in storedNames ? (solved)

​2) How can I remove all item from object(both array) having index value = indexed For example : I want to remove : abcd.png and 1

?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source