Sobes.tech
Intern — Middle

Function that creates an array without consecutive identical elements

livecode

Task condition

It is necessary to implement a function that takes an arbitrary sequence (string or array) as input and returns a new array in which consecutive identical values are removed, and the order of the remaining elements is preserved.

// EXAMPLE:
// func('AAAABBBCCDAABBB') => ['A', 'B', 'C', 'D', 'A', 'B']
// func('ABBCcAD') => ['A', 'B', 'C', 'c', 'A', 'D']
// func([1,2,2,3,3]) => [1,2,3]

function uniqueSequence(str) {}