Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const arrIds = [
- { ids: ["id1", "id2"] },
- { ids: ["id3", "id4"] },
- { ids: ["id5"] },
- { ids: ["id6", "id7"] }
- ] // id2_id4_id6
- const f = arr =>
- arr
- .map({ids} => ids)
- .filter(ids => ids.length > 1)
- .reduce((acc, ids) => acc.concat(ids), [])
- .filter(id => Number(id.slice(2)) % 2 === 0)
- .join("_")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement