Nagarro interview question

basic javascript and functional JS