diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 242d633459..1427597e97 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -666,22 +666,24 @@ "title": "Write Reusable JavaScript with Functions", "difficulty":"9.9819", "description":[ - "In JavaScript, we can divide up our code into reusable parts called functions.", + "In JavaScript, we can divide up our code into reusable parts called functions.", "Here's an example of a function:", - "function functionName (a, b) {", + "function functionName(a, b) {", "  return a + b;", "}", - "We can \"call\" our function like this: functionName();, and it will run and return its return value to us.", - "Create and call a function called myFunction that returns the sum of a and b." + "After writing the above lines in our code, we can then pass values to our function and the result following the return statement will be returned.", + "For example, we can pass numbers 4 and 2 by “calling” the function later in our code like this: functionName(4, 2).", + "In this example, the function will return the number 6 as this is the result of 4 + 2.", + "Create and call a function called myFunction that returns the sum of a and b." ], "tests":[ - "assert((function(){if(typeof(f) !== \"undefined\" && typeof(f) === \"number\" && f === a + b && editor.getValue().match(/return/gi).length >= 1 && editor.getValue().match(/a/gi).length >= 1 && editor.getValue().match(/b/gi).length >= 1 && editor.getValue().match(/\\+/gi).length >= 1){return true;}else{return false;}})(), 'Your function should return the value of a + b');" + "assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'Your function should return the value of a + b');" ], "challengeSeed":[ "var a = 4;", "var b = 5;", "", - "ourFunction = function() {", + "function ourFunction(a, b) {", " return a - b;", "};", "",