Node Js Function Declaration and Expression

I just started to learn Node Js then I got the following code in the tutorial

const readline = require("readline");

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

const questions = [
  "What is your name? ",
  "Where do you live? ",
  "What are you going to do with node js? "
];

const collectAnswers = (questions, done) => {
  const answers = [];
  const [firstQuestion] = questions;

  const questionAnswered = answer => {
    answers.push(answer);
    if (answers.length < questions.length) {
      rl.question(questions[answers.length], questionAnswered);
    } else {
      done(answers);
    }
  };

  rl.question(firstQuestion, questionAnswered);
};

collectAnswers(questions, answers => {
  console.log("Thank you for your answers. ");
  console.log(answers);
  process.exit();
});

The code has the following result

What is your name? a
Where do you live? b
What are you going to do with node js? c
Thank you for your answers.
[ 'a', 'b', 'c' ]

As far as I understand that the variable collectAnswer somehow inject the function declared below to the second parameter (done). Can someone explain what is actually happening behind the scene? How can the function declared below injected to the variable with the same name with it? Any term this pattern actually called?