Reputation: 337
I'm trying to loop over some objects that has '_order' included in the key, and make sure that their value is greater than the ${section.name}_order
and return those items.
What am I doing wrong? :)
const sectionsAfter = Object.keys(res.data()).filter((item) => (
item.includes('_order') && res.data()[item] > `${section.name}_order`
))
I was providing the wrong data. ${section.name}_order
wasn't returning the value I was after. It's now working as expected :)
Upvotes: 0
Views: 50
Reputation: 673
I am not sure the ${section.name}_order
is string or number.
If ${section.name}_order
is number then you shouldn't add ` around ${section.name}_order
. It will become string.
Upvotes: 1
Reputation: 1740
You are compare with the template string ${section.name}_order
You need get value of ${section.name}_order
Upvotes: 1