* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.3 KiB
1.3 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
| id | title | challengeType | videoUrl | forumTopicId | dashedName |
|---|---|---|---|---|---|
| 56533eb9ac21ba0edf2244c0 | Global vs. Local Scope in Functions | 1 | https://scrimba.com/c/c2QwKH2 | 18194 | global-vs--local-scope-in-functions |
--description--
It is possible to have both local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.
In this example:
var someVar = "Hat";
function myFun() {
var someVar = "Head";
return someVar;
}
The function myFun will return "Head" because the local version of the variable is present.
--instructions--
Add a local variable to myOutfit function to override the value of outerWear with "sweater".
--hints--
You should not change the value of the global outerWear.
assert(outerWear === 'T-Shirt');
myOutfit should return "sweater".
assert(myOutfit() === 'sweater');
You should not change the return statement.
assert(/return outerWear/.test(code));
--seed--
--seed-contents--
// Setup
var outerWear = "T-Shirt";
function myOutfit() {
// Only change code below this line
// Only change code above this line
return outerWear;
}
myOutfit();
--solutions--
var outerWear = "T-Shirt";
function myOutfit() {
var outerWear = "sweater";
return outerWear;
}