diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json
index 97b37c6fab..e2ac950334 100644
--- a/seed/challenges/basic-javascript.json
+++ b/seed/challenges/basic-javascript.json
@@ -42,11 +42,11 @@
"challengeSeed": [
"function welcomeToBooleans() {",
"",
- "// Only change code below this line.",
+ " // Only change code below this line.",
"",
" return false;",
"",
- "// Only change code above this line.",
+ " // Only change code above this line.",
"}",
"",
"welcomeToBooleans();"
@@ -70,10 +70,10 @@
"challengeSeed": [
"// var ourName = \"Free Code Camp\";",
"",
+ "// Only change code below this line.",
+ "",
"",
"// Only change code above this line.",
- "// We use this function to show you the value of your variable in your output box.",
- "// You'll learn about functions soon.",
"",
"if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}"
],
diff --git a/seed/challenges/json-apis-and-ajax.json b/seed/challenges/json-apis-and-ajax.json
index 9d75724a63..ea3a4351e2 100644
--- a/seed/challenges/json-apis-and-ajax.json
+++ b/seed/challenges/json-apis-and-ajax.json
@@ -7,11 +7,11 @@
"id": "bb000000000000000000001",
"title": "Trigger Click Events with jQuery",
"description": [
- "In this section, we'll learn how to get data from APIs. APIs are tools that computers use to communicate with one another.",
+ "In this section, we'll learn how to get data from APIs. APIs - or Application Interfaces - are tools that computers use to communicate with one another.",
"We'll also learn how to update HTML with the data we get from these APIs using a technology called Ajax.",
"First, let's review what the $(document).ready()
function does. This function makes it so all code inside of it only runs once our page loads.",
"Let's make our \"Get Message\" button change the text of the element with the class message
.",
- "Before we can do this, we need to implement a Click event inside of our $(document).ready()
function by adding this code:",
+ "Before we can do this, we need to implement a click event
inside of our $(document).ready()
function by adding this code:",
"$(\"#getMessage\").on(\"click\", function(){
",
"",
"});
"
@@ -55,9 +55,9 @@
"id": "bc000000000000000000001",
"title": "Change Text with Click Events",
"description": [
- "When our Click Event happens, we can use Ajax to update an HTML element.",
+ "When our click event happens, we can use Ajax to update an HTML element.",
"Let's make it so that when a user clicks the \"Get Message\" button, we change the text of the element with the class message
to say \"Here is the message\".",
- "We can do this by adding the following code within our Click event:",
+ "We can do this by adding the following code within our click event:",
" $(\".message\").html(\"Here is the message\");
"
],
"tests": [
@@ -75,6 +75,7 @@
"fcces",
"",
"",
+
"
{
and a }
.",
+ "You can also request data from an external source. This is where APIs come into play.",
+ "Remember that APIs - or Application Interfaces - are tools that computers use to communicate with one another.",
+ "Most web APIs transfer data in a format called JSON. JSON stands for JavaScript Object Notation.",
+ "You've already been using JSON whenever you create a JavaScript object. JSON is nothing more than object properties and their current values, sandwiched between a {
and a }
.",
"These properties and their values are often referred to as \"key-value pairs\".",
"Let's get the JSON from Free Code Camp's Cat Photo API.",
- "Here's the code you can put in your Click event to do this:",
+ "Here's the code you can put in your click event to do this:",
" $.getJSON(\"/json/cats.json?callback=\", function( json ) {
",
" $(\".message\").html(JSON.stringify(json))
",
- " });
"
+ " });
",
+ "Once you've added this, click the \"Get Message\" button. Your Ajax function will replace the \"The message will go here\" text with the raw JSON output from the Free Code Camp Cat Photo API."
],
"tests": [
"assert(editor.match(/\\$\\s*?\\(\\s*?(\\\"|\\')\\#getMessage(\\\"|\\')\\s*?\\)\\s*?\\.\\s*?on\\s*?\\(\\s*?(\\\"|\\')click(\\\"|\\')\\s*?\\,\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/gi), 'You should have a click handler on the getMessage button to trigger the AJAX request.')",
@@ -157,9 +160,10 @@
"id": "bb000000000000000000003",
"title": "Convert JSON Data to HTML",
"description": [
- "Now that we are getting data from a JSON API, let's display it in HTML.",
- "We can use the .map()
method to loop through our data and modify HTML elements.",
- "First we'll declare an HTML variable. Then we'll loop through our JSON, adding more HTML to that variable. When the loop is finished, we'll render it.",
+ "Now that we're getting data from a JSON API, let's display it in our HTML.",
+ "We can use the .map()
method to loop through our data and modify our HTML elements.",
+ "First, let's declare an html variable with var html = \"\";
.",
+ "Then, let's loop through our JSON, adding more HTML to that variable. When the loop is finished, we'll render it.",
"Here's the code that does this:",
"json.map(function(val) {
",
" html = html + \"<div class = 'cat'>\"
",
@@ -170,30 +174,32 @@
"});
"
],
"tests": [
- "assert(/json\\.map/gi, 'The message box should have something in it.')"
+ "assert(editor.match(/json\\.map/gi), 'The message box should have something in it.')"
],
"challengeSeed": [
"fccss",
- " $(document).ready(function() {",
- " ",
- " $(\"#getMessage\").on(\"click\", function() {",
- " $.getJSON(\"/json/cats.json?callback=\", function( json ) {",
- " ",
- " var html = \"\";",
- " ",
- " // Only change code below this line.",
- " ",
- " ",
- " ",
- " ",
- " // Only change code above this line.",
- " ",
- " $(\".message\").html(html);",
- " ",
- " });",
- " });",
- " ",
- " });",
+ " $(document).ready(function() {",
+ "",
+ " $(\"#getMessage\").on(\"click\", function() {",
+ " $.getJSON(\"/json/cats.json?callback=\", function( json ) {",
+ "",
+ " // Only change code below this line.",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ " // Only change code above this line.",
+ "",
+ " $(\".message\").html(html);",
+ "",
+ " });",
+ " });",
+ " });",
"fcces",
"",
"if (navigator.geolocation) {
",
" navigator.geolocation.getCurrentPosition(function(position) {
",
- " // Do something in here with the coordinates
",
" $(\"#data\").html(\"latitiude\" + position.coords.latitude + \"longitude\" + position.coords.longitude);
",
" });
",
"}
"