Anonymous Interview Question

write a js code for a problem statement