* 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.7 KiB
1.7 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244aa | Understanding Uninitialized Variables | 1 | https://scrimba.com/c/cBa2JAL | 18335 | understanding-uninitialized-variables |
--description--
When JavaScript variables are declared, they have an initial value of undefined
. If you do a mathematical operation on an undefined
variable your result will be NaN
which means "Not a Number". If you concatenate a string with an undefined
variable, you will get a literal string of "undefined"
.
--instructions--
Initialize the three variables a
, b
, and c
with 5
, 10
, and "I am a"
respectively so that they will not be undefined
.
--hints--
a
should be defined and evaluated to have the value of 6
.
assert(typeof a === 'number' && a === 6);
b
should be defined and evaluated to have the value of 15
.
assert(typeof b === 'number' && b === 15);
c
should not contain undefined
and should have a value of "I am a String!"
assert(!/undefined/.test(c) && c === 'I am a String!');
You should not change code below the specified comment.
assert(
/a = a \+ 1;/.test(code) &&
/b = b \+ 5;/.test(code) &&
/c = c \+ " String!";/.test(code)
);
--seed--
--after-user-code--
(function(a,b,c){ return "a = " + a + ", b = " + b + ", c = '" + c + "'"; })(a,b,c);
--seed-contents--
// Only change code below this line
var a;
var b;
var c;
// Only change code above this line
a = a + 1;
b = b + 5;
c = c + " String!";
--solutions--
var a = 5;
var b = 10;
var c = "I am a";
a = a + 1;
b = b + 5;
c = c + " String!";