* fix: remove isHidden flag from frontmatter * fix: add isUpcomingChange Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com> * feat: hide blocks not challenges Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com> Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>
1.8 KiB
1.8 KiB
id, title, challengeType, videoUrl, forumTopicId
id | title | challengeType | videoUrl | forumTopicId |
---|---|---|---|---|
5ee127a03c3b35dd45426493 | Assigning the Value of One Variable to Another | 1 | 418265 |
Description
var myVar;
myVar = 5;
var myNum;
myNum = myVar;
The above declares a myVar
variable with no value, then assigns it the value 5
. Next, a variable named myNum
is declared with no value. Then, the contents of myVar
(which is 5
) is assigned to the variable myNum
. Now, myNum
also has the value of 5
.
Instructions
a
to variable b
.
Tests
tests:
- text: You should not change code above the specified comment.
testString: assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code));
- text: <code>b</code> should have a value of 7.
testString: assert(typeof b === 'number' && b === 7);
- text: <code>a</code> should be assigned to <code>b</code> with <code>=</code>.
testString: assert(/b\s*=\s*a\s*/g.test(code));
Challenge Seed
// Setup
var a;
a = 7;
var b;
// Only change code below this line
Before Test
if (typeof a != 'undefined') {
a = undefined;
}
if (typeof b != 'undefined') {
b = undefined;
}
After Test
(function(a, b) {
return 'a = ' + a + ', b = ' + b;
})(a, b);
Solution
var a;
a = 7;
var b;
b = a;