Junior — Senior
Creating a unique string from current records considering their order
livecode
Task condition
There is an array of objects, each containing a string field value, a numeric parameter order, and a boolean flag expired. The task is to assemble a final string that includes only characters from records where expired is false. The records should be sorted by the order field in ascending order, and then for each string, take its characters in reverse order. When forming the result, duplicate characters should be excluded, leaving each character only once.
const input = [
{ value: 'abcd', order: 4, expired: false },
{ value: 'qwer', order: 2, expired: true },
{ value: 'xyz1', order: 1, expired: false },
{ value: 'abx2', order: 3, expired: false },
];
let buildString = () => {};
console.log(buildString); //1zyx2badc