fix(challenges): Fixed import export related challenges

Closes #16235
This commit is contained in:
Nick Karnik
2017-12-29 18:38:22 -08:00
parent 9dc3073003
commit ab08420ec2

View File

@ -827,6 +827,13 @@
"<hr>",
"Add the appropriate <code>import</code> statement that will allow the current file to use the <code>capitalizeString</code> function. The file where this function lives is called <code>\"string_functions\"</code>, and it is in the same directory as the current file."
],
"head": [
"window.require = function (str) {",
"if (str === 'string_functions') {",
"return {",
"capitalizeString: str => str.toUpperCase()",
"}}};"
],
"challengeSeed": [
"\"use strict\";",
"capitalizeString(\"hello!\");"
@ -852,6 +859,9 @@
"<hr>",
"Below are two variables that I want to make available for other files to use. Utilizing the first way I demonstrated <code>export</code>, export the two variables."
],
"head": [
"window.exports = function(){};"
],
"challengeSeed": [
"\"use strict\";",
"const foo = \"bar\";",
@ -879,6 +889,14 @@
"<hr>",
"The code below requires the contents of a file, <code>\"capitalize_strings\"</code>, found in the same directory as it, imported. Add the appropriate <code>import *</code> statement to the top of the file, using the object provided."
],
"head": [
"window.require = function(str) {",
"if (str === 'capitalize_strings') {",
"return {",
"capitalize: str => str.toUpperCase(),",
"lowercase: str => str.toLowerCase()",
"}}};"
],
"challengeSeed": [
"\"use strict\";",
"myStringModule.capitalize(\"foo\");",
@ -904,6 +922,9 @@
"<hr>",
"The following function should be the fallback value for the module. Please add the necessary code to do so."
],
"head": [
"window.exports = function(){};"
],
"challengeSeed": [
"\"use strict\";",
"function subtract(x,y) {return x - y;}"
@ -927,6 +948,13 @@
"<hr>",
"In the following code, please import the default export, <code>subtract</code>, from the file <code>\"math_functions\"</code>, found in the same directory as this file."
],
"head": [
"window.require = function(str) {",
"if (str === 'math_functions') {",
"return function(a, b) {",
"return a - b;",
"}}};"
],
"challengeSeed": [
"\"use strict\";",
"subtract(7,4);"