Files
freecodecamp--freecodecamp/curriculum/challenges/english/blocks/basic-javascript/5ee127a03c3b35dd45426493.md
T
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.4 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5ee127a03c3b35dd45426493 Assigning the Value of One Variable to Another 1 418265 assigning-the-value-of-one-variable-to-another

--description--

After a value is assigned to a variable using the assignment operator, you can assign the value of that variable to another variable using the assignment operator.

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--

Assign the contents of a to variable b.

--hints--

You should not change code above the specified comment.

assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code)));

b should have a value of 7.

assert(typeof b === 'number' && b === 7);

a should be assigned to b with =.

assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code)));

--seed--

--seed-contents--

// Setup
var a;
a = 7;
var b;

// Only change code below this line

--solutions--

var a;
a = 7;
var b;
b = a;