diff --git a/curriculum/challenges/_meta/es6/meta.json b/curriculum/challenges/_meta/es6/meta.json
index 5a9fbc337f..787ec72ad4 100644
--- a/curriculum/challenges/_meta/es6/meta.json
+++ b/curriculum/challenges/_meta/es6/meta.json
@@ -118,8 +118,6 @@
],
[
"5cdafbb0291309899753167f",
-<<<<<<< HEAD
-<<<<<<< HEAD
"Create a JavaScript Promise"
],
[
@@ -133,28 +131,6 @@
[
"5cdafbe72913098997531682",
"Handle a Rejected Promise with catch"
-=======
- "Create a Javascript Promise"
-=======
- "Create a JavaScript Promise"
->>>>>>> 950f80a92... Update curriculum/challenges/_meta/es6/meta.json
- ],
- [
- "5cdafbc32913098997531680",
- "Complete a Promise with Resolve and Reject"
- ],
- [
- "5cdafbd72913098997531681",
- "Handle a Fulfilled Promise with then"
- ],
- [
- "5cdafbe72913098997531682",
-<<<<<<< HEAD
- "Handle a Rejected Promise with .catch"
->>>>>>> 5aba19817... feat/new-lessons-on-js-promises
-=======
- "Handle a Rejected Promise with catch"
->>>>>>> 8dec9d7c7... fix/add-tests-rename-files
]
],
"helpRoom": "Help",
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.english.md
index 051ef832c4..f6762dc6b6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.english.md
@@ -6,9 +6,6 @@ challengeType: 1
## Description
pending
, fulfilled
, and rejected
. The promise you created in the last challenge is forever stuck in the pending
state because you did not add a way to complete the promise. The resolve
and reject
parameters given to the promise argument are used to do this. resolve
is used when you want your promise to succeed, and reject
is used when you want it to fail. These are methods that take an argument, as seen below.
```js
@@ -18,32 +15,6 @@ const myPromise = new Promise((resolve, reject) => {
} else {
reject("Promise was rejected");
}
-=======
-A promise has three states: pending
, fulfilled
, and rejected
. The promise you created in the last challenge is forever stuck in the pending
state because you did add a way to complete the promise. The two parameters given to the promise function are used to do this. resolve
is used when you want your promise to succeed, and reject
is used when you want it to fail. These are functions that take an argument as seen below.
-=======
-A promise has three states: pending
, fulfilled
, and rejected
. The promise you created in the last challenge is forever stuck in the pending
state because you did add a way to complete the promise. The resolve
and reject
parameters given to the promise argument are used to do this. resolve
is used when you want your promise to succeed, and reject
is used when you want it to fail. These are methods that take an argument, as seen below.
->>>>>>> 396e6142b... fix/update-verbiage
-=======
-A promise has three states: pending
, fulfilled
, and rejected
. The promise you created in the last challenge is forever stuck in the pending
state because you did not add a way to complete the promise. The resolve
and reject
parameters given to the promise argument are used to do this. resolve
is used when you want your promise to succeed, and reject
is used when you want it to fail. These are methods that take an argument, as seen below.
->>>>>>> aac94c586... Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.english.md
-
-```js
-const myPromise = new Promise((resolve, reject) => {
-<<<<<<< HEAD
- if(true) {
- resolve("Promise was fulfilled");
- } else {
- reject("Promise was rejected");
- }
->>>>>>> 5aba19817... feat/new-lessons-on-js-promises
-=======
- if(true) {
- resolve("Promise was fulfilled");
- } else {
- reject("Promise was rejected");
- }
->>>>>>> d3ba2b0ff... fix/replace-tab-with-spaces
-});
```
The example above uses strings for the argument of these functions, but it can really be anything. Often, it might be an object that you would use data from to put on your website or elsewhere.
@@ -51,27 +22,7 @@ The example above uses strings for the argument of these functions, but it can r
## Instructions
responseFromServer
is true
, call the resolve
method to successfully complete the promise. Pass resolve
a string with the value We got the data
. If responseFromServer
is false
, use the reject
method instead and pass it the string: Data not received
.
-=======
-Use the resolve
function if the condition is true to fulfill the promise. Pass it the string: We got the data.
as its argument. Use the reject
function if condition is not true and pass it the string: Data not received.
.
->>>>>>> 5aba19817... feat/new-lessons-on-js-promises
-=======
-Use the resolve
method if the condition given is true to fulfill the promise. Pass it the string: We got the data.
as its argument. Use the reject
method if condition is not true and pass it the string: Data not received.
.
->>>>>>> 396e6142b... fix/update-verbiage
-=======
-Use the resolve
method if the condition given is true to fulfill the promise. Pass it a string with the value We got the data
. Use the reject
method if condition is false and pass it the string: Data not received
.
->>>>>>> 8dec9d7c7... fix/add-tests-rename-files
-=======
-Make the promise handle success and failure. If responseFromServer
is true
, call the resolve
method to successfully complete the promise. Pass resolve
a string with the value We got the data
. If the condition is false
, use the reject
method instead and pass it the string: Data not received
.
->>>>>>> 3fa1528b7... Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.english.md
-=======
-Make the promise handle success and failure. If responseFromServer
is true
, call the resolve
method to successfully complete the promise. Pass resolve
a string with the value We got the data
. If responseFromServer
is false
, use the reject
method instead and pass it the string: Data not received
.
->>>>>>> 017c4ec24... fix/add-suggested-change-to-instructions
responseFromServer
```yml
tests:
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
- text: resolve
should be executed when the if
condition is true
.
testString: assert(removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g));
- text: reject
should be executed when the if
condition is false
.
testString: assert(removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g));
-=======
- - text: var
should not exist in code.
-=======
- - text: You should properly add a resolve
method.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g),'var
should not exist in code.');
- - text: You should properly add a reject
method.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g),'var
should not exist in code.');
- - text: resolve
is executed when the if
condition is true.
- testString: getUserInput => assert(!getUserInput('index').match(/var/g),'var
should not exist in code.');
- - text: reject
is executed when the if
condition is not true.
->>>>>>> 396e6142b... fix/update-verbiage
- testString: getUserInput => assert(!getUserInput('index').match(/var/g),'var
should not exist in code.');
->>>>>>> 5aba19817... feat/new-lessons-on-js-promises
-=======
- - text: resolve
should be executed when the if
condition is true
.
- testString: assert(removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g));
- - text: reject
should be executed when the if
condition is false
.
- testString: assert(removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g));
->>>>>>> 8dec9d7c7... fix/add-tests-rename-files
```
Promise
is a constructor function so you need to use the new
keyword to create one. It takes a function as its argument with two parameters, resolve
and reject
. These are methods used to determine the outcome of the promise. The syntax looks like this:
-=======
-A promise in javascript is exactly what it sounds like. You use it to make a promise to do something, and at some point you either fulfill your promise or fail to do so. It’s a constructor function, so they are create with the new
keyword. It needs a function as its argument with two parameters, resolve
and reject
. These are methods used to determine the outcome of the promise. The syntax looks like this:
->>>>>>> 5aba19817... feat/new-lessons-on-js-promises
-=======
-A promise in javascript is exactly what it sounds like. You use it to make a promise to do something, usually asynchronous. When the task completes you either fulfill your promise or fail to do so. It’s a constructor function, so they are created with the new
keyword. It needs a function as its argument with two parameters, resolve
and reject
. These are methods used to determine the outcome of the promise. The syntax looks like this:
->>>>>>> 396e6142b... fix/update-verbiage
-=======
-A promise in JavaScript is exactly what it sounds like. You use it to make a promise to do something, usually asynchronously. When the task completes you either fulfill your promise or fail to do so. Promise
is a constructor function so you need to use the new
keyword to create one. It needs a function as its argument with two parameters, resolve
and reject
. These are methods used to determine the outcome of the promise. The syntax looks like this:
->>>>>>> d86e97264... Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.english.md
-=======
-A promise in JavaScript is exactly what it sounds like. You use it to make a promise to do something, usually asynchronously. When the task completes you either fulfill your promise or fail to do so. Promise
is a constructor function so you need to use the new
keyword to create one. It takes a function as its argument with two parameters, resolve
and reject
. These are methods used to determine the outcome of the promise. The syntax looks like this:
->>>>>>> 915a966f1... fix/change-needs-to-takes-in-instructions
+A promise in JavaScript is exactly what it sounds like. You use it to make a promise to do something, usually asynchronously. When the task completes you either fulfill your promise or fail to do so. Promise
is a constructor function, so you need to use the new
keyword to create one. It takes a function as its argument with two parameters, resolve
and reject
. These are methods used to determine the outcome of the promise. The syntax looks like this:
```js
const myPromise = new Promise((resolve, reject) => {
@@ -42,15 +18,7 @@ const myPromise = new Promise((resolve, reject) => {
## Instructions
makeServerRequest
. Pass in a function with resolve
and reject
parameters to the constructor.
-=======
-Create a new promise called makeServerRequest
. Pass in a function with resolve
and reject
parameters to the promise.
->>>>>>> 5aba19817... feat/new-lessons-on-js-promises
-=======
-Create a new promise called makeServerRequest
. Pass in a function with resolve
and reject
parameters to the constructor.
->>>>>>> 79a812601... Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.english.md
makeServerRequest
. Pass in a function w
```yml
tests:
-<<<<<<< HEAD
-<<<<<<< HEAD
- text: You should assign a promise to a declared variable named makeServerRequest
.
testString: assert(makeServerRequest instanceof Promise);
- text: Your promise should receive a function with resolve
and reject
as parameters.
testString: assert(code.match(/Promise\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g));
-=======
- - text: Your promise should be in a variable called makeServerRequest
.
-=======
- - text: You should assign a promise to a declared variable named makeServerRequest
.
->>>>>>> 8f4cfb0e5... Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.english.md
- testString: assert(makeServerRequest instanceof Promise);
- - text: Your promise should receive a function with resolve
and reject
as parameters.
-<<<<<<< HEAD
-<<<<<<< HEAD
- testString: assert(typeof(makeServerRequest) === "object" && (code.match(/new\s*Promise\(\s*\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{/g) || code.match(/new\s*Promise\s*\(\s*function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{/g)));
->>>>>>> 5aba19817... feat/new-lessons-on-js-promises
-=======
- testString: assert(makeServerRequest instanceof Promise && (code.match(/new\s*Promise\(\s*\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{/g) || code.match(/new\s*Promise\s*\(\s*function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{/g)));
->>>>>>> 066e1792e... fix/add-tests
-=======
- testString: assert(code.match(/Promise\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g));
->>>>>>> 2a76bf50c... fix/make-tests-more-robust
```
then
method. The then
method is executed immediately after your promise is fulfilled with resolve
. Here’s an example:
+Promises are most useful when you have a process that takes an unknown amount of time in your code (i.e. something asynchronous), often a server request. When you make a server request it takes some amount of time, and after it completes you usually want to do something with the response from the server. This can be achieved by using the then
method. The then
method is executed immediately after your promise is fulfilled with resolve
. Here’s an example:
```js
myPromise.then(result => {
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.english.md~HEAD b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.english.md~HEAD
deleted file mode 100644
index 623ced0644..0000000000
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.english.md~HEAD
+++ /dev/null
@@ -1,90 +0,0 @@
----
-id: 5cdafbd72913098997531681
-title: Handle a Fulfilled Promise with then
-challengeType: 1
----
-
-## Description
-then
method. The then
method is executed immediately after your promise is fulfilled with resolve
. Here’s an example:
-
-```js
-myPromise.then(result => {
- // do something with the result.
-});
-```
-
-result
comes from the argument given to the resolve
method.
-then
method to your promise. Use result
as the argument of its callback function and log result
to the console.
-then
method on the promise.
- testString: assert(codeWithoutSpaces.match(/(makeServerRequest|\))\.then\(/g));
- - text: Your then
method should have a callback function with result
as its parameter.
- testString: assert(resultIsParameter);
- - text: You should log result
to the console.
- testString: assert(resultIsParameter && codeWithoutSpaces.match(/\.then\(.*?result.*?console.log\(result\).*?\)/));
-```
-
-catch
is the method used when your promise has been rejected. It is executed immediately after a promise's reject
method is called. Here’s the syntax:
-
-```js
-myPromise.catch(error => {
- // do something with the error.
-});
-```
-
-error
is the argument passed in to the reject
method.
-
-Note: the then
and catch
methods can be chained to the promise declaration if you chose.
-catch
method to your promise. Use error
as the argument of its callback function and log error
to the console.
-catch
method on the promise.
- testString: assert(codeWithoutSpaces.match(/(makeServerRequest|\))\.catch\(/g));
- - text: Your catch
method should have a callback function with error
as its parameter.
- testString: assert(errorIsParameter);
- - text: You should log error
to the console.
- testString: assert(errorIsParameter && codeWithoutSpaces.match(/\.catch\(.*?error.*?console.log\(error\).*?\)/));
-```
-
-