fix(curriculum): rework variable declarations in Greeting Bot workshop (#61783)

Co-authored-by: Ilenia M <nethleen@gmail.com>
This commit is contained in:
Supravisor
2025-09-16 18:41:49 +12:00
committed by GitHub
parent 881dfd8f78
commit fbf6bf2bcd
12 changed files with 43 additions and 62 deletions

View File

@@ -7,30 +7,30 @@ dashedName: step-4
# --description--
When you need to declare variables with multiple words, you can use the <dfn>camelCase</dfn> naming convention.
Now, it is time to assign a value to your `bot` variable.
When using `camelCase`, the first word is all lowercase and the first letter of each subsequent word is capitalized.
Here is an example:
In the previous lectures, you learned how to assign values to variables like this:
```js
let thisIsCamelCase;
variableName = "Here is the value";
```
Use `let` to declare a variable named `botLocation`.
Remember that what is on the right side of the assignment operator `=` is the value that you are assigning to the variable on the left side.
Assign the string `"teacherBot"` to the `bot` variable.
# --hints--
You should use `let` to declare the variable.
You should assign a string to your `bot` variable.
```js
assert.lengthOf(code.match(/let/g), 2);
assert.isString(bot);
```
Your variable should be named `botLocation`.
Your `bot` variable should be assigned the string `"teacherBot"`.
```js
assert.isNotNull(botLocation);
assert.equal(bot, "teacherBot");
```
# --seed--

View File

@@ -7,30 +7,32 @@ dashedName: step-5
# --description--
Now, it is time to assign some values to your `bot` and `botLocation` variables.
Now, it is time to initialize the `botLocation` variable.
In the previous lectures, you learned how to assign values to variables like this:
When you need to declare variables with multiple words, you can use the <dfn>camelCase</dfn> naming convention.
When using `camelCase`, the first word is all lowercase and the first letter of each subsequent word is capitalized.
Here is an example:
```js
variableName = "Here is the value";
let thisIsCamelCase = "Alice the camel is actually a horse.";
```
Remember that what is on the right side of the assignment operator `=` is the value that you are assigning to the variable on the left side.
Assign the string `"teacherBot"` to the `bot` variable and the string `"the universe"` to the `botLocation` variable.
Declare and assign the string `"the universe"` to the `botLocation` variable on the same line using the `let` keyword.
# --hints--
You should assign a string to your `bot` variable.
Use the `let` keyword to declare a variable.
```js
assert.isString(bot);
assert.lengthOf(__helpers.removeJSComments(code).match(/let/g), 2);
```
Your `bot` variable should be assigned the string `"teacherBot"`.
Your variable should be named `botLocation`.
```js
assert.equal(bot, "teacherBot");
assert.isNotNull(botLocation);
```
You should assign a string to your `botLocation` variable.
@@ -52,9 +54,8 @@ assert.equal(botLocation, "the universe");
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
--fcc-editable-region--

View File

@@ -32,12 +32,10 @@ assert.match(__helpers.removeJSComments(code), /("|')Allow\s+me\s+to\s+introduce
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
--fcc-editable-region--

View File

@@ -67,12 +67,10 @@ assert.match(__helpers.removeJSComments(code), /console\.log\s*\(\s*botIntroduct
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -56,12 +56,10 @@ assert.match(__helpers.removeJSComments(code), /console\.log\s*\(\s*botLocationS
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -34,12 +34,10 @@ assert.strictEqual(bot, "professorBot");
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -56,12 +56,10 @@ assert.match(__helpers.removeJSComments(code), /console\.log\s*\(\s*nicknameIntr
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -26,12 +26,10 @@ assert.strictEqual(bot, "awesomeTeacherBot");
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -56,12 +56,10 @@ assert.match(__helpers.removeJSComments(code), /console\.log\s*\(\s*newNicknameG
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -38,12 +38,10 @@ assert.strictEqual(favoriteSubject, "Computer Science");
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -54,12 +54,10 @@ assert.match(__helpers.removeJSComments(code), /console\.log\s*\(\s*favoriteSubj
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");

View File

@@ -33,12 +33,10 @@ assert.match(__helpers.removeJSComments(code), /console\.log\s*\(\s*["']Well\s*,
```js
console.log("Hi there!");
console.log("I am excited to talk to you.");
let bot;
let botLocation;
bot = "teacherBot";
botLocation = "the universe";
let botLocation = "the universe";
console.log("Allow me to introduce myself.");