Hack Frontend Community

Concatenate Strings from Objects

SberTinkoffMail.ru
Write a function getConcated(arr) that takes an array of objects arr and returns a string formed according to the following rules:
  • - Elements must be ordered by the order field in ascending order.
  • - Elements with expired: true must be excluded.
  • - The value field of each object must be reversed (characters in reverse order).
  • - The string should not contain duplicate characters.

Examples:

Input 1: [{ value: "aabb", order: 1, expired: false }, { value: "bbaa", order: 2, expired: false }]
Output 1: "ba"
Input 2: [{ value: "hello", order: 1, expired: false }, { value: "world", order: 2, expired: false }]
Output 2: "olehdrw"
Run your code to see results.