fix(curriculum): Added 9 missing solutions to challenges in the Debugging section (#35750)

* fix: add 9 solutions to challenges

* fix: remove extra line

Co-Authored-By: RandellDawson <5313213+RandellDawson@users.noreply.github.com>
This commit is contained in:
Randell Dawson
2019-04-18 11:44:20 -07:00
committed by The Coding Aviator
parent 7aceb4595e
commit 54bc113721
9 changed files with 71 additions and 9 deletions

View File

@ -54,6 +54,13 @@ console.log(power);
<section id='solution'>
```js
// solution required
function raiseToPower(b, e) {
return Math.pow(b, e);
}
let base = 2;
let exp = 3;
let power = raiseToPower(base, exp);
console.log(power);
```
</section>

View File

@ -56,6 +56,13 @@ console.log(result);
<section id='solution'>
```js
// solution required
function getNine() {
let x = 6;
let y = 3;
return x + y;
}
let result = getNine();
console.log(result);
```
</section>

View File

@ -57,6 +57,9 @@ console.log(`Net working capital is: ${netWorkingCapital}`);
<section id='solution'>
```js
// solution required
let receivables = 10;
let payables = 8;
let netWorkingCapital = receivables - payables;
console.log(`Net working capital is: ${netWorkingCapital}`);
```
</section>

View File

@ -53,6 +53,7 @@ console.log(innerHtml);
<section id='solution'>
```js
// solution required
let innerHtml = "<p>Click here to <a href=\"#Home\">return home</a></p>";
console.log(innerHtml);
```
</section>

View File

@ -63,6 +63,16 @@ countToFive();
<section id='solution'>
```js
// solution required
function countToFive() {
let firstFive = "12345";
let len = firstFive.length;
// Fix the line below
for (let i = 0; i < len; i++) {
// Do not alter code below this line
console.log(firstFive[i]);
}
}
countToFive();
```
</section>

View File

@ -50,6 +50,8 @@ console.log(`Sum of array values is: ${arraySum}`);
<section id='solution'>
```js
// solution required
let myArray = [1, 2, 3];
let arraySum = myArray.reduce((previous, current) => previous + current);
console.log(`Sum of array values is: ${arraySum}`);
```
</section>

View File

@ -61,6 +61,16 @@ console.log(result);
<section id='solution'>
```js
// solution required
let x = 7;
let y = 9;
let result = "to come";
if(x === y) {
result = "Equal!";
} else {
result = "Not equal!";
}
console.log(result);
```
</section>

View File

@ -54,6 +54,10 @@ function myFunc() {
<section id='solution'>
```js
// solution required
function myFunc() {
for (let i = 1; i <= 4; i += 2) {
console.log("Still going!");
}
}
```
</section>

View File

@ -68,6 +68,24 @@ console.log(matrix);
<section id='solution'>
```js
// solution required
function zeroArray(m, n) {
// Creates a 2-D array with m rows and n columns of zeroes
let newArray = [];
for (let i = 0; i < m; i++) {
let row = [];
// Adds the m-th row into newArray
for (let j = 0; j < n; j++) {
// Pushes n zeroes into the current row to create the columns
row.push(0);
}
// Pushes the current row, which now has n zeroes in it, to the array
newArray.push(row);
}
return newArray;
}
let matrix = zeroArray(3, 2);
console.log(matrix);
```
</section>