Pass the function itself

A callback is a function that another function calls.

your task

Give runCheck a function it can call. Each room’s three lines must start with “start”, “checking”, and “end”, in that order.

The starter prints the room’s check message before the runner starts. Then runCheck stops when it tries to call its second argument.

Starter code
or press Ctrl EnterNot run yet

cases

Not run yetAtlas

Expected output

1start Atlas
2checking Atlas
3end Atlas
See the input and the code for this case
const roomName = "Atlas";
function runCheck(name, body) {
  console.log("start " + name);
  body();
  console.log("end " + name);
}
Not run yetBirch

Expected output

1start Birch
2checking Birch
3end Birch
See the input and the code for this case
const roomName = "Birch";
function runCheck(name, body) {
  console.log("start " + name);
  body();
  console.log("end " + name);
}