Micro Focus interview question

Algorithms in JS