Skip to content Skip to sidebar Skip to footer

Accessing Object Properties Where The Property Name Is In A Variable

I am trying to check if a certain item exists in a JS object. To do this, I need to use whatever ID is passed into my method. At the moment I'm struggling to actually use the varia

Solution 1:

Use data.entries[id]; // Where id is a variable

This notation is to access the property using a variable

Post a Comment for "Accessing Object Properties Where The Property Name Is In A Variable"