mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-22 21:08:12 +08:00
fix(curriculum): re-order role-playing-game to define before use (#52885)
Co-authored-by: sidemt <25644062+sidemt@users.noreply.github.com>
This commit is contained in:
parent
c1eb26fa9b
commit
99266b388a
@ -153,31 +153,31 @@
|
||||
"title": "Step 35"
|
||||
},
|
||||
{
|
||||
"id": "62a3c0ab883fd9435cd5c518",
|
||||
"id": "62a3c668afc43b4a134cca81",
|
||||
"title": "Step 36"
|
||||
},
|
||||
{
|
||||
"id": "62a3c2fccf186146b59c6e96",
|
||||
"id": "62a3c8bf3980c14c438d2aed",
|
||||
"title": "Step 37"
|
||||
},
|
||||
{
|
||||
"id": "62a3c4a0e52767482c5202d4",
|
||||
"id": "62a3c91a2bab1b4d6fabb726",
|
||||
"title": "Step 38"
|
||||
},
|
||||
{
|
||||
"id": "62a3c668afc43b4a134cca81",
|
||||
"id": "62a3cdb11478a34ff4a6470d",
|
||||
"title": "Step 39"
|
||||
},
|
||||
{
|
||||
"id": "62a3c8bf3980c14c438d2aed",
|
||||
"id": "62a3c0ab883fd9435cd5c518",
|
||||
"title": "Step 40"
|
||||
},
|
||||
{
|
||||
"id": "62a3c91a2bab1b4d6fabb726",
|
||||
"id": "62a3c2fccf186146b59c6e96",
|
||||
"title": "Step 41"
|
||||
},
|
||||
{
|
||||
"id": "62a3cdb11478a34ff4a6470d",
|
||||
"id": "62a3c4a0e52767482c5202d4",
|
||||
"title": "Step 42"
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 62a3c0ab883fd9435cd5c518
|
||||
title: Step 36
|
||||
title: Step 40
|
||||
challengeType: 0
|
||||
dashedName: step-36
|
||||
dashedName: step-40
|
||||
---
|
||||
|
||||
# --description--
|
||||
@ -141,4 +141,15 @@ const monsterHealthText = document.querySelector("#monsterHealth");
|
||||
--fcc-editable-region--
|
||||
|
||||
--fcc-editable-region--
|
||||
function goStore() {
|
||||
console.log("Going to store.");
|
||||
}
|
||||
|
||||
function goCave() {
|
||||
console.log("Going to cave.");
|
||||
}
|
||||
|
||||
function fightDragon() {
|
||||
console.log("Fighting dragon.");
|
||||
}
|
||||
```
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 62a3c2fccf186146b59c6e96
|
||||
title: Step 37
|
||||
title: Step 41
|
||||
challengeType: 0
|
||||
dashedName: step-37
|
||||
dashedName: step-41
|
||||
---
|
||||
|
||||
# --description--
|
||||
@ -15,7 +15,7 @@ You can access properties in JavaScript a couple of different ways. The first is
|
||||
button.onclick
|
||||
```
|
||||
|
||||
Use dot notation to set the `onclick` property of your `button1` to the function reference of `goStore`. This function will be something you write later. Note that `button1` is already declared, so you don't need to use `let` or `const`.
|
||||
Use dot notation to set the `onclick` property of your `button1` to the function reference of `goStore`. Note that `button1` is already declared, so you don't need to use `let` or `const`.
|
||||
|
||||
# --hints--
|
||||
|
||||
@ -146,4 +146,15 @@ const monsterHealthText = document.querySelector("#monsterHealth");
|
||||
// initialize buttons
|
||||
|
||||
--fcc-editable-region--
|
||||
function goStore() {
|
||||
console.log("Going to store.");
|
||||
}
|
||||
|
||||
function goCave() {
|
||||
console.log("Going to cave.");
|
||||
}
|
||||
|
||||
function fightDragon() {
|
||||
console.log("Fighting dragon.");
|
||||
}
|
||||
```
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
---
|
||||
id: 62a3c4a0e52767482c5202d4
|
||||
title: Step 38
|
||||
title: Step 42
|
||||
challengeType: 0
|
||||
dashedName: step-38
|
||||
dashedName: step-42
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Using the same syntax, set the `onclick` properties of `button2` and `button3` to `goCave` and `fightDragon` respectively.
|
||||
|
||||
Once you have done that, open your console and try clicking the buttons on your project.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use dot notation to access the `onclick` property of `button2`.
|
||||
@ -157,4 +159,15 @@ const monsterHealthText = document.querySelector("#monsterHealth");
|
||||
button1.onclick = goStore;
|
||||
|
||||
--fcc-editable-region--
|
||||
function goStore() {
|
||||
console.log("Going to store.");
|
||||
}
|
||||
|
||||
function goCave() {
|
||||
console.log("Going to cave.");
|
||||
}
|
||||
|
||||
function fightDragon() {
|
||||
console.log("Fighting dragon.");
|
||||
}
|
||||
```
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 62a3c668afc43b4a134cca81
|
||||
title: Step 39
|
||||
title: Step 36
|
||||
challengeType: 0
|
||||
dashedName: step-39
|
||||
dashedName: step-36
|
||||
---
|
||||
|
||||
# --description--
|
||||
@ -15,14 +15,14 @@ function functionName() {
|
||||
}
|
||||
```
|
||||
|
||||
Create an empty function named `goStore`. This will match the `goStore` variable you used earlier.
|
||||
Create an empty function named `goStore`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should declare `goStore` with the `function` keyword.
|
||||
|
||||
```js
|
||||
assert.match(code, /function\s*goStore()/);
|
||||
assert.match(code, /function\s+goStore()/);
|
||||
```
|
||||
|
||||
`goStore` should be defined.
|
||||
@ -148,11 +148,6 @@ const monsterStats = document.querySelector("#monsterStats");
|
||||
const monsterName = document.querySelector("#monsterName");
|
||||
const monsterHealthText = document.querySelector("#monsterHealth");
|
||||
|
||||
// initialize buttons
|
||||
button1.onclick = goStore;
|
||||
button2.onclick = goCave;
|
||||
button3.onclick = fightDragon;
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
--fcc-editable-region--
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 62a3c8bf3980c14c438d2aed
|
||||
title: Step 40
|
||||
title: Step 37
|
||||
challengeType: 0
|
||||
dashedName: step-40
|
||||
dashedName: step-37
|
||||
---
|
||||
|
||||
# --description--
|
||||
@ -134,11 +134,6 @@ const monsterStats = document.querySelector("#monsterStats");
|
||||
const monsterName = document.querySelector("#monsterName");
|
||||
const monsterHealthText = document.querySelector("#monsterHealth");
|
||||
|
||||
// initialize buttons
|
||||
button1.onclick = goStore;
|
||||
button2.onclick = goCave;
|
||||
button3.onclick = fightDragon;
|
||||
|
||||
--fcc-editable-region--
|
||||
function goStore() {
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
---
|
||||
id: 62a3c91a2bab1b4d6fabb726
|
||||
title: Step 41
|
||||
title: Step 38
|
||||
challengeType: 0
|
||||
dashedName: step-41
|
||||
dashedName: step-38
|
||||
---
|
||||
|
||||
# --description--
|
||||
@ -140,11 +140,6 @@ const monsterStats = document.querySelector("#monsterStats");
|
||||
const monsterName = document.querySelector("#monsterName");
|
||||
const monsterHealthText = document.querySelector("#monsterHealth");
|
||||
|
||||
// initialize buttons
|
||||
button1.onclick = goStore;
|
||||
button2.onclick = goCave;
|
||||
button3.onclick = fightDragon;
|
||||
|
||||
function goStore() {
|
||||
console.log("Going to store.");
|
||||
}
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
---
|
||||
id: 62a3cdb11478a34ff4a6470d
|
||||
title: Step 42
|
||||
title: Step 39
|
||||
challengeType: 0
|
||||
dashedName: step-42
|
||||
dashedName: step-39
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
Now create a `fightDragon` function that prints `Fighting dragon.` to the console.
|
||||
|
||||
Once you have done that, open your console and try clicking the buttons on your project.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use the `function` keyword to declare `fightDragon`.
|
||||
@ -142,11 +140,6 @@ const monsterStats = document.querySelector("#monsterStats");
|
||||
const monsterName = document.querySelector("#monsterName");
|
||||
const monsterHealthText = document.querySelector("#monsterHealth");
|
||||
|
||||
// initialize buttons
|
||||
button1.onclick = goStore;
|
||||
button2.onclick = goCave;
|
||||
button3.onclick = fightDragon;
|
||||
|
||||
function goStore() {
|
||||
console.log("Going to store.");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user