fix(guide) add stubs, update spellings and prepare for move (#36531)

* fix(guide) add stubs and correct file path misspellings and pr… (#36528)

* fix: corrected file path to match curriculum

* fix: renamed to newer challenge name

* fix: added solutions to articles from challenge files

* fix: added missing .english to file name

* fix: added missing title to guide article

* fix: correct solution for guide article

* fix: replaced stub with hint

* fix: added space in Hint headers

* fix: added solution to guide article

* fix: added solution to guide article

* test: replaced stub with hint and solution

* fix: add Problem number: to title

* fix: changed generatorexponential to correct name

* fix: renamed knight's tour to knights-tour

* fix: updated guide article
This commit is contained in:
mrugesh
2019-07-30 00:25:58 +05:30
committed by GitHub
parent e23c80a021
commit 91df817cfe
89 changed files with 3074 additions and 129 deletions

View File

@@ -17,7 +17,7 @@ JavaScript uses the `/` symbol for division.
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
var quotient = 0.6 / 0.3; //quotient gets the value 2
var quotient = 4.4 / 2.0; // Fix this line
```
</details>

View File

@@ -0,0 +1,25 @@
---
title: Use Recursion to Create a Range of Numbers
---
# Use Recursion to Create a Range of Numbers
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
function rangeOfNumbers(startNum, endNum) {
if (endNum - startNum === 0) {
return [startNum];
} else {
var numbers = rangeOfNumbers(startNum, endNum - 1);
numbers.push(endNum);
return numbers;
}
}
```
</details>

View File

@@ -0,0 +1,25 @@
---
title: Complete a Promise with resolve and reject
---
# Complete a Promise with resolve and reject
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer represents a response from a server
let responseFromServer;
if(responseFromServer) {
resolve("We got the data");
} else {
reject("Data not received");
}
});
```
</details>

View File

@@ -0,0 +1,17 @@
---
title: Create a JavaScript Promise
---
# Create a JavaScript Promise
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
const makeServerRequest = new Promise((resolve, reject) => {
});
```
</details>

View File

@@ -0,0 +1,21 @@
---
title: Create a Module Script
---
# Create a Module Script
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```html
<html>
<body>
<!-- add your code below -->
<script type="module" src="index.js"></script>
<!-- add your code above -->
</body>
</html>
```
</details>

View File

@@ -0,0 +1,28 @@
---
title: Handle a Fulfilled Promise with then
---
# Handle a Fulfilled Promise with then
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer is set to true to represent a successful response from a server
let responseFromServer = true;
if(responseFromServer) {
resolve("We got the data");
} else {
reject("Data not received");
}
});
makeServerRequest.then(result => {
console.log(result);
});
```
</details>

View File

@@ -0,0 +1,32 @@
---
title: Handle a Rejected Promise with catch
---
# Handle a Rejected Promise with catch
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
const makeServerRequest = new Promise((resolve, reject) => {
// responseFromServer is set to false to represent an unsuccessful response from a server
let responseFromServer = false;
if(responseFromServer) {
resolve("We got the data");
} else {
reject("Data not received");
}
});
makeServerRequest.then(result => {
console.log(result);
});
makeServerRequest.catch(error => {
console.log(error);
});
```
</details>

View File

@@ -0,0 +1,19 @@
---
title: Reuse Javascript Code Using import
---
# Reuse Javascript Code Using import
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
import { uppercaseString, lowercaseString } from './string_functions.js';
// add code above this line
uppercaseString("hello");
lowercaseString("WORLD!");
```
</details>

View File

@@ -4,9 +4,26 @@ title: Use Destructuring Assignment to Assign Variables from Objects
# Use Destructuring Assignment to Assign Variables from Objects
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/quadratic-equations/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
---
## Solutions
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<details><summary>Solution 1 (Click to Show/Hide)</summary>
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->
```javascript
const HIGH_TEMPERATURES = {
yesterday: 75,
today: 77,
tomorrow: 80
};
// change code below this line
const { today: highToday, tomorrow: highTomorrow } = HIGH_TEMPERATURES;
// change code above this line
console.log(highToday); // should be 77
console.log(highTomorrow); // should be 80
```
</details>

View File

@@ -0,0 +1,29 @@
---
title: Use Destructuring Assignment to Extract Values from Objects
---
# Use Destructuring Assignment to Extract Values from Objects
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
const HIGH_TEMPERATURES = {
yesterday: 75,
today: 77,
tomorrow: 80
};
// change code below this line
const { today, tomorrow } = HIGH_TEMPERATURES;
// change code above this line
console.log(yesterday) // should be not defined
console.log(today); // should be 77
console.log(tomorrow); // should be 80
```
</details>

View File

@@ -0,0 +1,21 @@
---
title: Use export to Share a Code Block
---
# Use export to Share a Code Block
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```javascript
export const uppercaseString = (string) => {
return string.toUpperCase();
}
export const lowercaseString = (string) => {
return string.toLowerCase()
}
```
</details>

View File

@@ -1,7 +1,7 @@
---
title: Write Concise Object Literal Declarations Using Simple Fields
title: Write Concise Object Literal Declarations Using Object Property Shorthand
---
# Write Concise Object Literal Declarations Using Simple Fields
# Write Concise Object Literal Declarations Using Object Property Shorthand
---
## Problem Explanation

View File

@@ -17,10 +17,10 @@ Use the `join` method (among others) inside the `sentensify` function to make a
---
## Hints
### Hint1
### Hint 1
You may need to convert the string to an array first.
### Hint2
### Hint 2
You may need to use regular expression to split the string.