diff --git a/curriculum/challenges/_meta/es6/meta.json b/curriculum/challenges/_meta/es6/meta.json
index fa536e30b3..748be5ab01 100644
--- a/curriculum/challenges/_meta/es6/meta.json
+++ b/curriculum/challenges/_meta/es6/meta.json
@@ -98,11 +98,11 @@
],
[
"587d7b8c367417b2b2512b56",
- "Use export to Reuse a Code Block"
+ "Use export to Share a Code Block"
],
[
"587d7b8c367417b2b2512b55",
- "Share Javascript Code Using import"
+ "Reuse Javascript Code Using import"
],
[
"587d7b8c367417b2b2512b57",
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.english.md
new file mode 100644
index 0000000000..5ae6740a7d
--- /dev/null
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.english.md
@@ -0,0 +1,82 @@
+---
+id: 587d7b8c367417b2b2512b55
+title: Reuse Javascript Code Using import
+challengeType: 1
+---
+
+## Description
+
+import
allows you to choose which parts of a file or module to load. In the previous lesson, the examples exported add
from the file math_functions.js
. Here's how you can import them into another file:
+
+```js
+import { add } from './math_functions.js';
+```
+
+Here, import
will find add
in math_functions.js
, import just that function for you to use, and ignore the rest. The ./
tells the import to look for the math_functions.js
file in the same folder that the file which uses the import statement is. The relative file path (./
) and file extension (.js
) are required when using import in this way.
+
+You can import multiple items like this:
+
+```js
+import { add, subtract } from './math_functions.js';
+```
+
+
+
+## Instructions
+
+Add the appropriate import
statement that will allow the current file to use the capitalizeString
and lowerCaseString
functions you exported in the previous lesson. These functions are in a file called string_functions.js
, which is in the same directory as the current file.
+
+
+## Tests
+
+
+```yml
+tests:
+ - text: You should properly import capitalizeString
.
+ testString: getUserInput => assert(getUserInput('index').match(/import\s*\{\s*capitalizeString\s*\}\s*from\s*("|')(\.\/string_functions|string_functions)\1(|\/\/|;\s|\s)/g));
+ - text: You should properly import lowerCaseString
.
+ testString: getUserInput => assert(getUserInput('index').match(/import\s*\{\s*capitalizeString\s*\}\s*from\s*("|')(\.\/string_functions|string_functions)\1(|\/\/|;\s|\s)/g));
+```
+
+
+
+## Challenge Seed
+
+
+
+```js
+
+
+
+// add code above this line
+
+console.log(capitalizeString("hello"));
+console.log(lowerCaseString("WORLD!"));
+```
+
+
+
+### Before Test
+
+
+```js
+self.require = function() {
+ return {
+ capitalizeString: str => str.toUpperCase(),
+ lowerCaseString: str => str.toLowerCase()
+ }
+};
+```
+
+
+
+
+## Solution
+
+
+```js
+import { capitalizeString } from './string_functions';
+capitalizeString("hello!");
+```
+
+
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/share-javascript-code-using-import.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/share-javascript-code-using-import.english.md
deleted file mode 100644
index 2f060f42a9..0000000000
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/share-javascript-code-using-import.english.md
+++ /dev/null
@@ -1,73 +0,0 @@
----
-id: 587d7b8c367417b2b2512b55
-title: Share Javascript Code Using import
-challengeType: 1
----
-
-## Description
-
-In the past, require()
was used to add things from external files. While handy, this presents a problem: some files are rather large and you may only need certain parts of those external resources.
-ES6 gives you a very handy tool known as import
. With it, you can choose which parts of a file or module to load, saving time and memory.
-Imagine a file that has 20 functions, but you only need to use one of those functions. require()
would force you to bring in all 20 functions. With the import
syntax, you can bring in just the one you need, like so:
-import { desired_function } from './other_file';
-Here, import
will find desired_function
in other_file
, import just that function for you to use, and ignore the rest. The ./
tells the import to look for the other_file
in the same folder that the file which uses the import statement is in. The whitespace around the function inside the curly braces is best practice for readability.
-You can import multiple items like this:
-import { item1, item2 } from './other_file';
-There are a few ways to write an import
statement, but the above are a very common use-case.
-
-
-## Instructions
-
-Add the appropriate import
statement that will allow the current file to use the capitalizeString
function. The file where this function lives is called string_functions
, and it is in the same directory as the current file.
-
-
-## Tests
-
-
-```yml
-tests:
- - text: Use a valid import
statement
- testString: getUserInput => assert(getUserInput('index').match(/import\s*\{\s*capitalizeString\s*\}\s*from\s*("|')(\.\/string_functions|string_functions)\1(|\/\/|;\s|\s)/g));
-```
-
-
-
-## Challenge Seed
-
-
-
-
-```js
-"use strict";
-
-capitalizeString("hello!");
-```
-
-
-
-### Before Test
-
-
-```js
-self.require = function (str) {
- if (str === 'string_functions') {
- return {
- capitalizeString: str => str.toUpperCase()
- }
- }
-};
-```
-
-
-
-
-
-## Solution
-
-
-```js
-import { capitalizeString } from './string_functions';
-capitalizeString("hello!");
-```
-
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block.english.md
deleted file mode 100644
index 20c30dabcb..0000000000
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-reuse-a-code-block.english.md
+++ /dev/null
@@ -1,81 +0,0 @@
----
-id: 587d7b8c367417b2b2512b56
-title: Use export to Reuse a Code Block
-challengeType: 1
----
-
-## Description
-
-Imagine you have a function, capitalizeFirstLetter
, that simply takes in a string and returns the string with the first letter capitalized. You want to use this function in several different javascript files. In order to share the function with the files, you need to first export
it.
-
-```js
-export const capitalizeFirstLetter = (string) => {
- return string.charAt(0).toUpperCase() + string.slice(1);
-}
-```
-
-The above is a common way to export a single function, but you can achieve the same thing like this:
-
-```js
-const capitalizeFirstLetter = (string) => {
- return string.charAt(0).toUpperCase() + string.slice(1);
-}
-
-export { capitalizeFirstLetter };
-```
-
-After you export a function like this, you can import it in another file to use without having to rewrite the function.
-
-
-## Instructions
-
-Create and export a variable named
-
-
-## Tests
-
-
-```yml
-tests:
- - text: foo
is exported.
- testString: getUserInput => assert(getUserInput('index').match(/export\s+const\s+foo\s*=\s*"bar"/g), 'foo
is exported.');
- - text: bar
is exported.
- testString: getUserInput => assert(getUserInput('index').match(/export\s+const\s+bar\s*=\s*"foo"/g), 'bar
is exported.');
-
-```
-
-
-
-## Challenge Seed
-
-
-
-
-```js
-"use strict";
-
-```
-
-
-
-### Before Test
-
-
-```js
-self.exports = function(){};
-```
-
-
-
-
-
-
-## Solution
-
-
-```js
-"use strict";
-export const foo = "bar";
-export const bar = "foo";
-```
-
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.english.md
new file mode 100644
index 0000000000..b18c2aa4bb
--- /dev/null
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.english.md
@@ -0,0 +1,96 @@
+---
+id: 587d7b8c367417b2b2512b56
+title: Use export to Share a Code Block
+challengeType: 1
+---
+
+## Description
+
+Imagine a file called math_functions.js
, it contains several functions related to mathematical operations. One of them is stored in a variable, add
, that takes in two numbers and returns the sum of them. You want to use this function in several different javascript files. In order to share it with the files, you need to first export
it.
+
+```js
+export const add = (x, y) => {
+ return x + y;
+}
+```
+
+The above is a common way to export a single variable, but you can achieve the same thing like this:
+
+```js
+const add = (x, y) => {
+ return x + y;
+}
+
+export { add };
+```
+
+After you export a variable, you can import it in another file to use without having to rewrite the code. You can export multiple variables one at a time by repeating the first example for each thing you want to export or by placing them all in the export statement of the second example like this:
+
+```js
+export { add, subtract };
+```
+
+
+
+## Instructions
+
+There are two functions related to strings in the editor. Export both of them using the method of your choice.
+
+
+## Tests
+
+
+```yml
+tests:
+ - text: You should not alter the functions.
+ testString: getUserInput => assert(getUserInput('index').match(/export\s+const\s+foo\s*=\s*"bar"/g), 'foo
is exported.');
+ - text: capitalizeString
is properly exported.
+ testString: getUserInput => assert(getUserInput('index').match(/export\s+const\s+bar\s*=\s*"foo"/g), 'bar
is exported.');
+ - text: lowerCaseString
is properly exported.
+
+```
+
+
+
+## Challenge Seed
+
+
+
+
+```js
+const capitalizeString = (string) => {
+ return string.toUpperCase();
+}
+
+const lowercaseString = (string) => {
+ return string.toLowerCase()
+}
+```
+
+
+
+### Before Test
+
+
+```js
+self.exports = function(){};
+```
+
+
+
+
+
+
+## Solution
+
+
+```js
+export const capitalizeString = (string) => {
+ return string.toUpperCase();
+}
+
+export const lowercaseString = (string) => {
+ return string.toLowerCase()
+}
+```
+