JavaScript algorithmization test