Trainline interview question

Q: Javascript functions