Is it possible to get the index of an object in JavaScript?
For example:
categories = {
'1':{code:'HW', name:'Hardware'},
'2':{code:'SW', name:'Software'},
'3':{code:'OS', name:'Office Supplies'},
}
I am trying to get the index of software, but when I use indexOf
, I receive an error stating that indexOf is not a function
. This is because it's a list of objects. Can this be achieved in any other way?
Here is a sample fiddle for you guys to test: https://jsfiddle.net/50wL7mdz/86966/
Thank you in advance