How to apply selector from JS array

How to apply selector from JS array

Hello,

I'm sure there is probably an easy operator I can use to work with this, but consider the following.

I have the following JS, starting from a slightly complex array of objects, that I then want to apply a selector for it.

  1. var key = "Some Key";
  2. var someData = [ ... ];
  3. $(someData).selector("[data-attr='" + key + "']").doSomethingWithSelection(...);

I know how to work with selectors in general, and they are quite powerful. I'm not sure how to do the same when starting from known value(s) or an array of values.

Thanks!