fix(curriculum): Consolidated comments for JavaScript Algorithms and Data Structures challenges - part 2 of 4 (#38259)

This commit is contained in:
Randell Dawson
2020-03-02 23:18:30 -08:00
committed by GitHub
parent 012e5c848b
commit 6a7a7e6d7d
69 changed files with 111 additions and 141 deletions

View File

@ -54,7 +54,7 @@ var ourData = ourArray[0]; // equals 50
// Setup
var myArray = [50,60,70];
// Only change code below this line.
// Only change code below this line
```

View File

@ -54,7 +54,7 @@ tests:
// Setup
var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];
// Only change code below this line.
// Only change code below this line
var myData = myArray[0][0];
```

View File

@ -77,7 +77,7 @@ var testObj = {
19: "Unitas"
};
// Only change code below this line;
// Only change code below this line
var playerNumber; // Change this Line
var player = testObj; // Change this Line

View File

@ -59,7 +59,7 @@ var myDog = {
"friends": ["freeCodeCamp Campers"]
};
// Only change code below this line.
// Only change code below this line
```

View File

@ -75,7 +75,7 @@ var ourDog = {
"friends": ["everything!"]
};
// Only change code below this line.
// Only change code below this line
var myDog = {

View File

@ -70,7 +70,6 @@ function testGreaterThan(val) {
return "10 or Under";
}
// Change this value to test
testGreaterThan(10);
```

View File

@ -56,12 +56,10 @@ var a = 3;
var b = 17;
var c = 12;
// Only modify code below this line
// Only change code below this line
a = a + 12;
b = 9 + b;
c = c + 7;
```
</div>

View File

@ -49,12 +49,10 @@ var a = 48;
var b = 108;
var c = 33;
// Only modify code below this line
// Only change code below this line
a = a / 12;
b = b / 4;
c = c / 11;
```
</div>

View File

@ -49,13 +49,10 @@ var a = 5;
var b = 12;
var c = 4.6;
// Only modify code below this line
// Only change code below this line
a = a * 5;
b = 3 * b;
c = c * 10;
```
</div>

View File

@ -49,13 +49,10 @@ var a = 11;
var b = 9;
var c = 3;
// Only modify code below this line
// Only change code below this line
a = a - 6;
b = b - 15;
c = c - 1;
```
</div>

View File

@ -60,7 +60,7 @@ for (var i = 10; i > 0; i -= 2) {
// Setup
var myArray = [];
// Only change code below this line.
// Only change code below this line
```

View File

@ -25,7 +25,7 @@ creates a <code>variable</code> called <code>ourName</code>. In JavaScript we en
## Instructions
<section id='instructions'>
Use the <code>var</code> keyword to create a variable called <code>myName</code>.
<strong>Hint</strong><br>Look at the <code>ourName</code> example if you get stuck.
<strong>Hint</strong><br>Look at the <code>ourName</code> example above if you get stuck.
</section>
## Tests
@ -46,10 +46,7 @@ tests:
<div id='js-seed'>
```js
// Example
var ourName;
// Declare myName below this line
```

View File

@ -57,7 +57,7 @@ var myDog = {
"bark": "woof"
};
// Only change code below this line.
// Only change code below this line
```

View File

@ -38,7 +38,7 @@ tests:
<div id='js-seed'>
```js
var quotient = 0.0 / 2.0; // Fix this line
var quotient = 0.0 / 2.0; // Change this line
```
</div>

View File

@ -50,7 +50,7 @@ firstNameLength = firstName.length;
var lastNameLength = 0;
var lastName = "Lovelace";
// Only change code below this line.
// Only change code below this line
lastNameLength = lastName;

View File

@ -42,11 +42,11 @@ tests:
```js
function randomFraction() {
// Only change code below this line.
// Only change code below this line
return 0;
// Only change code above this line.
// Only change code above this line
}
```

View File

@ -49,7 +49,7 @@ var randomNumberBetween0and19 = Math.floor(Math.random() * 20);
function randomWholeNum() {
// Only change code below this line.
// Only change code below this line
return Math.random();
}

View File

@ -51,7 +51,7 @@ function ourRandomRange(ourMin, ourMax) {
ourRandomRange(1, 9);
// Only change code below this line.
// Only change code below this line
function randomRange(myMin, myMax) {

View File

@ -14,7 +14,7 @@ Variables which are used without the <code>var</code> keyword are automatically
## Instructions
<section id='instructions'>
Using <code>var</code>, declare a <code>global</code> variable <code>myGlobal</code> outside of any function. Initialize it with a value of <code>10</code>.
Using <code>var</code>, declare a global variable named <code>myGlobal</code> outside of any function. Initialize it with a value of <code>10</code>.
Inside function <code>fun1</code>, assign <code>5</code> to <code>oopsGlobal</code> <strong><em>without</em></strong> using the <code>var</code> keyword.
</section>
@ -42,7 +42,7 @@ tests:
<div id='js-seed'>
```js
// Declare your variable here
// Declare the myGlobal variable below this line
function fun1() {
@ -51,6 +51,7 @@ function fun1() {
}
// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
@ -112,15 +113,12 @@ uncapture();
```js
// Declare your variable here
var myGlobal = 10;
function fun1() {
// Assign 5 to oopsGlobal Here
oopsGlobal = 5;
}
// Only change code above this line
function fun2() {
var output = "";
if(typeof myGlobal != "undefined") {

View File

@ -57,7 +57,7 @@ for (var i = 0; i < 10; i += 2) {
// Setup
var myArray = [];
// Only change code below this line.
// Only change code below this line
```

View File

@ -62,7 +62,7 @@ for (var i = 0; i < 5; i++) {
// Setup
var myArray = [];
// Only change code below this line.
// Only change code below this line
```

View File

@ -53,7 +53,7 @@ tests:
// Setup
var myArray = [];
// Only change code below this line.
// Only change code below this line
```

View File

@ -51,7 +51,9 @@ tests:
```js
function myLocalScope() {
'use strict'; // you shouldn't need to edit this line
'use strict';
// Only change code below this line
console.log(myVar);
}

View File

@ -56,7 +56,7 @@ var removedFromOurArray = ourArray.pop();
// Setup
var myArray = [["John", 23], ["cat", 2]];
// Only change code below this line.
// Only change code below this line
var removedFromMyArray;

View File

@ -50,7 +50,7 @@ ourArray.push(["happy", "joy"]);
// Setup
var myArray = [["John", 23], ["cat", 2]];
// Only change code below this line.
// Only change code below this line
```

View File

@ -45,7 +45,7 @@ var removedFromOurArray = ourArray.shift();
// Setup
var myArray = [["John", 23], ["dog", 3]];
// Only change code below this line.
// Only change code below this line
var removedFromMyArray;
@ -72,7 +72,7 @@ var removedFromMyArray;
```js
var myArray = [["John", 23], ["dog", 3]];
// Only change code below this line.
// Only change code below this line
var removedFromMyArray = myArray.shift();
```

View File

@ -45,7 +45,7 @@ ourArray.unshift("Happy");
var myArray = [["John", 23], ["dog", 3]];
myArray.shift();
// Only change code below this line.
// Only change code below this line
```

View File

@ -51,7 +51,7 @@ ourArray[1] = 45; // ourArray now equals [18,45,99].
// Setup
var myArray = [18,64,99];
// Only change code below this line.
// Only change code below this line
```

View File

@ -37,7 +37,7 @@ tests:
// Example
var ourArray = [["the universe", 42], ["everything", 101010]];
// Only change code below this line.
// Only change code below this line
var myArray = [];
```

View File

@ -59,7 +59,6 @@ function multiplyAll(arr) {
return product;
}
// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
```

View File

@ -57,7 +57,7 @@ function ourFunctionWithArgs(a, b) {
}
ourFunctionWithArgs(10, 5); // Outputs 5
// Only change code below this line.
// Only change code below this line
```

View File

@ -49,7 +49,7 @@ tests:
<div id='js-seed'>
```js
//Setup
// Setup
var contacts = [
{
"firstName": "Akira",

View File

@ -68,7 +68,6 @@ function abTest(a, b) {
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
// Change values below to test your code
abTest(2,2);
```

View File

@ -59,12 +59,13 @@ tests:
```js
function isLess(a, b) {
// Fix this code
// Only change code below this line
if (a < b) {
return true;
} else {
return false;
}
// Only change code above this line
}
// Change these values to test

View File

@ -46,17 +46,20 @@ tests:
```js
function nextInLine(arr, item) {
// Your code here
// Only change code below this line
return item;
// Only change code above this line
return item; // Change this line
}
// Test Setup
// Setup
var testArr = [1,2,3,4,5];
// Display Code
// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));
```

View File

@ -44,7 +44,7 @@ tests:
// Example
var ourArray = ["John", 23];
// Only change code below this line.
// Only change code below this line
var myArray = [];
```

View File

@ -62,7 +62,6 @@ function checkObj(checkProp) {
return "Change Me!";
}
// Test your code by modifying these values
checkObj("gift");
```

View File

@ -54,9 +54,8 @@ tests:
var myStr = "Jello World";
// Only change code below this line
myStr[0] = "H"; // Fix Me
myStr[0] = "H"; // Change this line
// Only change code above this line
```

View File

@ -39,11 +39,11 @@ tests:
```js
function welcomeToBooleans() {
// Only change code below this line.
// Only change code below this line
return false; // Change this line
// Only change code above this line.
// Only change code above this line
}
```

View File

@ -55,12 +55,12 @@ tests:
<div id='js-seed'>
```js
// Declarations
// Variable declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;
// Assignments
// Variable assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;

View File

@ -40,17 +40,15 @@ tests:
<div id='js-seed'>
```js
// Initialize these three variables
// Only change code below this line
var a;
var b;
var c;
// Do not change code below this line
// Only change code above this line
a = a + 1;
b = b + 5;
c = c + " String!";
```
</div>

View File

@ -69,7 +69,7 @@ var myDog = {
"friends": ["freeCodeCamp Campers"]
};
// Only change code below this line.
// Only change code below this line
```

View File

@ -45,7 +45,7 @@ var lastLetterOfFirstName = firstName[firstName.length - 1];
// Setup
var lastName = "Lovelace";
// Only change code below this line.
// Only change code below this line
var lastLetterOfLastName = lastName;

View File

@ -45,7 +45,7 @@ var secondLetterOfFirstName = firstName[1];
// Setup
var lastName = "Lovelace";
// Only change code below this line.
// Only change code below this line
var thirdLetterOfLastName = lastName;

View File

@ -70,11 +70,11 @@ function ourTrueOrFalse(isItTrue) {
// Setup
function trueOrFalse(wasThatTrue) {
// Only change code below this line.
// Only change code below this line
// Only change code above this line.
// Only change code above this line
}

View File

@ -67,10 +67,11 @@ tests:
```js
//Only change code below this line
// Only change code below this line
function countdown(n){
return;
}
// Only change code above this line
console.log(countdown(5)); // [5, 4, 3, 2, 1]
```
@ -91,7 +92,6 @@ const removeJSComments = str => str.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
<section id='solution'>
```js
//Only change code below this line
function countdown(n){
return n < 1 ? [] : [n].concat(countdown(n - 1));
}

View File

@ -54,8 +54,9 @@ var myAdjective = "big";
var myVerb = "ran";
var myAdverb = "quickly";
var wordBlanks = ""; // Only change this line;
// Only change code below this line
var wordBlanks = ""; // Change this line
// Only change code above this line
```
</div>