SmartQ interview question

1- Pattern based question in js