FCC Bonfire Series 101 + 102: Meet Bonfire

Free Code Camp is great, and we all love it. The FCC Bonfire Series will go through every algorithm practice exercise proposed by FCC one at a time, explaining the solution thoroughly so we all understand what’s going on.

Exercises start up -very- easy, but get gradually harder, so bear with me while I tackle the first few algorithm practice solutions, and wait for the good stuff that comes after that.

Our first exercise, “Meet Bonfire”, is simple enough. We are presented with a piece of code where a function returns false when we want it to return true. For many of you this may be trivial, but for those out there who are just starting out, here’s the solution, and the explanation.

function meetBonfire(argument) {
// Good luck!
  console.log("you can read this function's argument in the developer tools", argument);

  return false;
}

meetBonfire("You can do this!");

As we can see, this function returns the value false in the fifth line; changing it to true should solve our problem:

function meetBonfire(argument) {
// Good luck!
  console.log("you can read this function's argument in the developer tools", argument);

  return true;
}

meetBonfire("You can do this!"); // --> true

All set! The function will now return true everytime. Stay sharp, I’ll be back tomorrow with a new bonfire explanation!