I need some help in writing recursive javascript function to achieve something but I am really struggling to achieve that. Can someone please help me or guide me on this.