15.05 · Function syntax & scope / Watch · 16 min
Trace scope with Rob Use the original scope code-along to distinguish a local binding from a similarly named outer one.
Activity 5 of 8 in Function syntax & scope
All coursesJavaScript Basics / 15.05
Trace scope with Rob Not started
Use the original scope code-along to distinguish a local binding from a similarly named outer one.
More options
Rob’s comic strip · Function syntax & scope ORIGINAL WALKTHROUGH · 15:38
Watch with Rob. Pause whenever you want to try a change. You can return to the lesson at any time.
THE CODE ZONE / WATCH WITH ROB Trace scope with Rob Watch with a membership or start a free trial 15:38 × LEARN WITH THE CODE ZONE
Unlock this video walkthrough Written lessons and coding practice are free. Video walkthroughs are included with a paid Code Zone membership or an active free trial.
Have a Code Zone website account? Use your learning account’s email to get a six-digit sign-in code, or use your existing website password.
Need a website account? Paid Skool members and active trial members can use the email from their membership questions to request a sign-in code. No invite link or Skool password needed.
Close this window to keep practicing. After signing in, you’ll return to this lesson.
You are signed in, but video access needs attention. Check your account access . Your saved work is kept.
Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.
Open video & code editor (opens in a new tab) Starter source code for VS Code Copy the source below or download the file to follow along in VS Code.
The download includes a lesson link in each file and a README so you can find your way back.
script.js Copy code
script.js javascript · example
// Code along: Trace scope with Rob
// Follow the video and build the program yourself.
// Supplied starting values
let count = 10 ;
Watch and code side by side. Open Theater Mode in a new tab with this video on the left and your code editor on the right. Switch either pane to the lesson notes when you need a reference. Your lesson task is already in the editor. Run your code, save a private account draft when signed in, and share a help link in The Code Zone community.
This workspace has its own saved code. It won’t replace your work in the shorter practice activity.
Read parameters and return a local result Work through 3 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) 3 steps · Saved work · Instant feedback
YOUR TURN
Try the examples on this page Choose Load this code into the editor beside an example, then edit and Run code here. Predict what will print before running it. This is an exploration workspace, so there is no pass/fail challenge. Its saved work stays separate from the next practice activity.
Load an example, edit it and run it. Word wrap is enabled.
THE CODE ZONE / YOUR CODING WORKSPACE Open live editor Click to reveal your workspace. No installation needed. 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
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
let count = 10 ;
function inspectCount () {
let count = 20 ;
console. log ( "inside " + count);
}
inspectCount ();
console. log ( "outside " + count); Replace your editor code? Your current work will be replaced. Choose Cancel to keep it.
Cancel Replace code Open the code-along notes Run one example at a time The original notes include deliberate ReferenceError examples. An uncaught error stops later statements, so do not paste every failing example into one running program.
This complete example isolates shadowing. Predict inside 20 and outside 10. The local let count creates a new binding; it does not reassign the outer count.
Run one example at a time Copy code
example.js javascript · example
let count = 10 ;
function inspectCount () {
let count = 20 ;
console. log ( "inside " + count);
}
inspectCount ();
console. log ( "outside " + count); Load this code into the editor Ready to try it? Practice in your browser and see your results.
Progress details Continue learning 15.04 Find where a name is visibleNext: 15.06 Return the local message