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 coursesJavaScript Basics / 13.03
Make the function run Not started
The greeting recipe exists, but nobody has called it yet.
More options
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.
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.
THE CODE ZONE / YOUR CODING WORKSPACE Open live editor Click to reveal your workspace. No installation needed. Ready to check Run the checks to see your results here.
View test details Run code Check challenge Reset starterAsk a question & share code Save to GitHub Save to GitHub Save your current code with optional notes in this lesson’s GitHub folder.
Keep your code. Keep your progress. Save your coursework to your own GitHub repository as part of your Code Zone membership.
An active coding community to learn alongside A place to ask questions and get help when you’re stuck GitHub saves to keep a versioned backup of your work
Checking your GitHub connection…
Connect GitHub Change repository Disconnect GitHub
Choose Only select repositories on GitHub and select your learning repository. Your other repositories do not need to be connected.
Learning repositoryChoose a repository Refresh repositories Use this repository
Choose an existing repository, or create a learning repository on GitHub (opens in a new tab) . Include a README when creating it so it has a default branch, then connect it here.
Saved to GitHub Your code and notes are saved.
Close modal
View example solution
Save your code to your profile. Choose Save account draft to keep this workspace in your profile and continue on another device. Your account draft opens automatically when this device has no local draft; Load account draft lets you choose it yourself. Submit sends a fixed copy of your code and current browser checks to your instructor. You can submit even if a check fails. After your first submission, an instructor or tutor must reopen this exercise before you can submit changed code again. Saving drafts and experimenting stay available.
Save account draft Load account draft
Look for an existing answer in the community, then share your question and code if you are stuck.
Your community question or submission note (optional) Want direct instructor help? Describe what you tried and where you got stuck in your submission note. You can hide this prompt in My account → Learning preferences.
Submit for review Refresh submission status & feedback
Ask the community and share your code Create a fixed copy of your current code, question above, and current browser check results. Anyone with the link can view it without signing in. Your email, private drafts, and instructor feedback are not included. You can choose whether to show your name below.
Check your code and question for passwords or personal information before sharing. You can revoke the link here later.
Asking for help
Include this name and initials avatar on my shared page I want anyone with the link to see this code and question.Create and copy help link Your active help links for this exercise Refresh shared links
Your submissions and instructor feedback
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 Copy code
example.js javascript · 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.
One possible solution Your code may look different and still be correct. Compare the approach with your own.
Try a third name without changing the function body. Explain why a definition alone does not run the body.
Example solution Copy code
example.js javascript · example
function greet (name) {
console. log ( "Hello, " + name + "!" );
}
greet ( "Ada" );
greet ( "Lin" ); Load this code into the editor Replace your editor code? Your current work will be replaced. Choose Cancel to keep it.
Cancel Replace code Ready to try it? Practice in your browser and see your results.
Progress details Continue learning 13.02 Code functions with RobNext: 13.04 Send a result back 7 days freeTry The Code Zone
THE CODE ZONE COMMUNITY
Your next step is easier together. Try the community free for 7 days.
No charge during your trial. Choose your plan on Skool.
Ask questions and get support in the community Watch every course video walkthrough Find a study buddy in the 24/7 study room Make the most of your trial with Premium. Choose Premium on Skool to try Thursday live help sessions. Bring your questions, work through code, and get unstuck together.
Scheduled Thursdays in Eastern Time. Check the Skool calendar for your local date and time.
Have a website account? Sign in