Perfios Software interview question

Basic JavaScript concepts. Coding problem.