thecodezone.
The Code Zone
Short steps, at your pace · Free lessons and practice · Member video walkthroughs
Save your next small win.

Checking your account…

13.03 · Reusable functions / Practice · 5 min

Make the function run

The greeting recipe exists, but nobody has called it yet.

Activity 3 of 6 in Reusable functions

All courses

JavaScript Basics / 13.03

Make the function run

Not started

The greeting recipe exists, but nobody has called it yet.

More options
Rob finds a silent greeting machine beside two unprocessed name cards; he inspects its unused call button, then prepares the Ada and Lin cards for two separate calls.
Rob’s comic strip · Reusable functions

Define a function, call it and use its return value

Work through 4 focused steps. Read the explanation, type each requested change and check it before moving on. Your own code carries forward.

The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.

Start mini-lesson(opens in a new tab)

4 steps · Saved work · Instant feedback

YOUR TURN

Call the greeting function

Keep the greet function. Replace the two bare references with calls that pass "Ada" and "Lin", in that order. Print exactly Hello, Ada! and Hello, Lin!, once each.

Expected output
Hello, Ada!
Hello, Lin!

Keep the starting inputs. Print these lines in this order, without extra output.

Edit JavaScript, then run it. Check Challenge shows which output checks pass or need a fix. Word wrap is enabled.

Ready to checkRun the checks to see your results here.

Work in VS Code instead

Copy the starter into a file named practice.js in VS Code. If Node.js is installed, open the terminal in that folder and run node practice.js. Compare the output with the task above. Automated challenge checks are available in the browser editor.

Code example
example.jsjavascript · example
function greet(name) {
  console.log("Hello, " + name + "!");
}
greet;
greet;

Need a nudge?

Follow the values

A bare function name refers to the function. Parentheses call it; put the name argument inside the parentheses.

Replace your editor code?

Your current work will be replaced. Choose Cancel to keep it.

Ready to try it?

Practice in your browser and see your results.

Progress details

Have a question?

Ask the Code Zone community.

Ask a question in The Code Zone (opens in a new tab)

Continue learning

ONE STEP FORWARD

Use parentheses to call a function and supply its argument.