Advertisement
finalmail

arr ids

Jan 7th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const arrIds = [
  2.   { ids: ["id1", "id2"] },
  3.   { ids: ["id3", "id4"] },
  4.   { ids: ["id5"] },
  5.   { ids: ["id6", "id7"] }
  6. ] // id2_id4_id6
  7.  
  8. const f = arr =>
  9.   arr
  10.     .map({ids} => ids)
  11.     .filter(ids => ids.length > 1)
  12.     .reduce((acc, ids) => acc.concat(ids), [])
  13.     .filter(id => Number(id.slice(2)) % 2 === 0)
  14.     .join("_")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement