Threshold interview question

JavaScript