Anonymous interview question

write a js code for a problem statement