Singular Analysts interview question

Java Script