Importing More Checks explainer


The aim of this puzzle: Use one of the imported “checking” functions as a callback

Walkthrough of the solution: The 1st line of code imports several functions. Importing is a way to include code that’s written somewhere else, in a different file. There are 4 “checking” functions that take a string and print out a message based on if the string includes a certain word. The checkPassport function looks for the word 'Passport'. The checkTicket function looks for the word 'Ticket'. And checkVehicle and checkHotel do a similar check.

In this puzzle, you need to change the callback function again. The callback is chosen where the updateAllAndCheck() is called. The 4th argument is the name of a function without parentheses. The checkPassport should be replaced with either checkTicket, checkVehicle, or checkHotel.

Sample code solution:
(Tap below to reveal)

import { updateAllNames, checkPassport, checkTicket, checkVehicle, checkHotel } from '';

function updateAllAndCheck(string, oldPart, newPart, extraCheck) {
  return updateAllNames(string, oldPart, newPart);

travelDocument = updateAllAndCheck(travelDocument, 'grasshoper', 'grasshopper', checkVehicle);

JavaScript Concepts: Callback Functions, Calling Functions, Code Block (function), console.log(), import