Skip to content

Commit

Permalink
Update json-apis-and-ajax.json
Browse files Browse the repository at this point in the history
  • Loading branch information
benmcmahon100 committed Oct 29, 2015
1 parent c03d715 commit bd1eb10
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions seed/challenges/json-apis-and-ajax.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@
"Here's the code that does this:",
"<code>json.map(function(val) {</code>",
"<code>&thinsp;&thinsp;html = html + \"&lt;div class = 'cat'&gt;\"</code>",
"<code>&thinsp;&thinsp;for(var key in val) {</code>",
"<code>&thinsp;&thinsp;&thinsp;&thinsp;html = html + '&lt;div class = \"' + key + '\"&gt;' + val[key] + '&lt;/div&gt;';</code>",
"<code>&thinsp;&thinsp;}</code>",
"<code>&thinsp;&thinsp;html = html + '&lt;div&gt;' + val + '&lt;/div&gt;';</code>",
"<code>&thinsp;&thinsp;html = html + \"&lt;/div&gt;&lt;br/&gt;\"</code>",
"<code>});</code>"
],
Expand Down Expand Up @@ -229,14 +227,12 @@
"In the JSON that we receive from Free Code Camp's Cat Photo API, each object has an attribute called \"imageLink\".",
"When we're looping through these objects, let's check whether an object attribute (key) is <code>imageLink</code>. If it is, instead of outputing the image link, let's render the image.",
"Here's the code that does this:",
"<code>if(key === \"imageLink\") {</code>",
"<code>&thinsp;&thinsp;html = html + '&lt;img class = \"' + key + '\"src = \"' + val[key] + '\"&gt;';</code>",
"<code>} else {</code>",
"<code>&thinsp;&thinsp;html = html + '&lt;div class = \"' + key + '\"&gt;' + val[key] + '&lt;/div&gt;';</code>",
"<code>if(val.match(\"http\")) {</code>",
"<code>&thinsp;&thinsp;html = html + '&lt;img src = \"' + val + '\"&gt;';</code>",
"<code>}</code>"
],
"tests": [
"assert(editor.match(/imageLink/gi), 'You should have accessed the imageLink of each cat object.')"
"assert(editor.match(/val.match/gi), 'You should have accessed the imageLink of each cat object.')"
],
"challengeSeed": [
"fccss",
Expand All @@ -251,16 +247,12 @@
"",
" html = html + \"<div class = 'cat'>\"",
"",
" for (var key in val) {",
"",
" // Only change code below this line.",
"",
"",
"",
" // Only change code above this line.",
"",
" }",
"",
" html = html + \"</div>\"",
"",
" });",
Expand Down Expand Up @@ -328,11 +320,7 @@
"",
" // Only change code above this line.",
"",
" for(var key in val){",
"",
" html = html + '<div class = \"' + key + '\">' + val[key] + '</div>';",
"",
" }",
" html = html + '<div>' + val + '</div>';",
"",
" html = html + \"</div>\"",
"",
Expand Down

0 comments on commit bd1eb10

Please sign in to comment.