Function Factory
Call That Code!
Real World Ninjas
Fix the Function
Mini Missions
100

What does a function do in your code?

What is it runs a set of instructions?

100

How do you “run” a function?

What is by calling it with ()?

100

Why would a ninja use a function in their code dojo?

What is to organize their code like a master?

100

What’s wrong? 

function sayHi {

  console.log("Hi!");

}

What is missing the () after sayHi?

100

Create a function that says “Code Rocks!” 

function cheer() {

  console.log("Code Rocks!");

}

200

What is the name of the part where you write what the function does?

What is the function body?

200

What will this code print? 

function ninja() {

  console.log("Slice!");

}

ninja();

What is Slice!?

200

What real-life activity is like a function?

What is following a recipe?

200

What’s wrong with this function call? 

greet;

What is it's missing () — should be greet();

200

Make a function named clap() that prints 👏👏👏

function clap() {

  console.log("👏👏👏");

}

300

What word do we use to start making a function in JavaScript?

What is function?

300

If a function is named jump, how do you use it?

What is jump();?

300

True or False: A light switch is like a function.

What is true!

300

Find the bug: 

function dance() {

  console.log("Dancing")

What is missing the closing }?

300

Write a function that adds 2 numbers and logs the result.

function add(a, b) {

  console.log(a + b);

}

400

What do we call the name and inputs of a function?

What is the function header?

400

What happens if you forget the () when calling a function?

What is the function doesn’t run?

400

What’s a good name for a function that makes your ninja jump in a game?

What is jumpNinja() or doJump()?

400

What’s wrong? 

function doMath(x, y) {

  return x + y;

}

doMath(3);

What is it's missing a second argument?

400

Write a function that says “Good job, Ninja [name]!”

function praise(name) {

  console.log("Good job, Ninja " + name + "!");

}

500

What does the word "return" do in a function?

What is it sends a value back?

500

Can you call a function inside another function?

What is yes!

500

If your ninja does karate moves, what could the function be called?

What is karateKick() or performMove()?

500

What’s wrong? 

function double(x) {

  return x x;

}

What is it needs an operator like x * 2?

500

Create a function that returns the area of a rectangle (length × width).

function getArea(length, width) {

  return length * width;

}

M
e
n
u