Pergunta de entrevista da empresa ShopSe

There was an image showing the expected outputs based on specific inputs and I had to guess the pattern and write code. eg: const x = foo(10); console.log(x()) // 10 console.log(x(30)) // 30 console.log(x()) // 30 console.log(x()) // 30 console.log(x(400)) // 400