Fixed 'Write Reusable JavaScript with Functions' head and tail

pull/9098/head
DealPete 2016-06-10 19:30:04 -02:30
parent 56903828e3
commit 78bbf1e767
1 changed files with 18 additions and 16 deletions

View File

@ -2041,19 +2041,7 @@
"<h4>Instructions</h4>",
"<ol><li>Create a function called <code>reusableFunction</code> which prints <code>\"Hi World\"</code> to the dev console.</li><li>Call the function.</li></ol>"
],
"challengeSeed": [
"// Example",
"function reusableFunction() {",
" console.log(\"Heyya, World\");",
"}",
"",
"reusableFunction();",
"",
"// Only change code below this line",
"",
""
],
"tail": [
"head": [
"var logOutput = \"\";",
"var originalConsole = console",
"function capture() {",
@ -2073,12 +2061,26 @@
" console.log = originalConsole.log;",
"}",
"",
"capture();"
],
"challengeSeed": [
"// Example",
"function reusableFunction() {",
" console.log(\"Heyya, World\");",
"}",
"",
"reusableFunction();",
"",
"// Only change code below this line",
"",
""
],
"tail": [
"uncapture();",
"",
"if (typeof reusableFunction !== \"function\") { ",
" (function() { return \"reusableFunction is not defined\"; })();",
"} else {",
" capture();",
" reusableFunction(); ",
" uncapture();",
" (function() { return logOutput || \"console.log never called\"; })();",
"}"
],