A backstage label needs a shared site name and a section name used only while building the label. Scope is the part of your program where a variable name is available.
const gardenName = "East Garden";
function describePlot() {
const plotName = "Herbs";
return `${gardenName}: ${plotName}`;
}
console.log(describePlot());
console.log(gardenName);
The function can read gardenName from its surrounding scope. Its local plotName exists inside the function; trying to log plotName outside it would produce a ReferenceError. Returning the label gives the caller a value, not access to the local variable itself.
A let or const declared inside an if or loop block also stays inside that block. Here, keep siteName outside buildLabel and sectionName inside it. The probes check their observable results, not where you typed the declarations.
Run the example and notice that only the shared name gets its own outside log.
siteName to "Frontend Lab".buildLabel(): declare local sectionName = "Variables" and return ${siteName} - ${sectionName}.buildLabel() on its own line.Edit script.js, then Run after each step. The supplied probes show the values being checked; leave them in place. Submit checks the numbered tasks in order. You do not need to write extra checkpoint logs.
Use the outer siteName inside your function.
Create a local sectionName inside the function and return a combined string.