From 7d2029780e6b8a3387752b6805d0f92627e1ad22 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 5 Jul 2015 17:03:41 -0700 Subject: [PATCH 01/13] clear basic-javascript.json --- challenges/basic-javascript.json | 233 ------------------------------- 1 file changed, 233 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index b8ae5cbaa1..e69de29bb2 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -1,233 +0,0 @@ -{ - "name": "Basic JavaScript", - "order": 0.006, - "challenges": [ - { - "id": "bd7129d8c441eddfaeb5bdef", - "name": "Waypoint: Build an Adventure Game", - "dashedName": "waypoint-build-an-adventure-game", - "difficulty": 0.24, - "challengeSeed": ["114604814"], - "description": [ - "Now that you understand some Computer Science fundamentals, let's focus on programming JavaScript!", - "We're going to work through Codecademy's famous interactive JavaScript course.", - "This course will teach us some JavaScript fundamentals while guiding us through the process of building interesting web apps, all within Codecademy's learner-friendly environment!", - "Go to http://www.codecademy.com/courses/getting-started-v2/0/1 and complete the section.", - "Be sure to also complete this section: http://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/1." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7130d8c441eddfaeb5bdef", - "name": "Waypoint: Build Rock Paper Scissors", - "dashedName": "waypoint-build-rock-paper-scissors", - "difficulty": 0.25, - "challengeSeed": ["114604815"], - "description": [ - "Now we'll learn how JavaScript functions work, and use them to build a simple Rock Paper Scissors game.", - "Go to http://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/1 and complete the section.", - "Be sure to also complete this section: http://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/0/1." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7131d8c441eddfaeb5bdef", - "name": "Waypoint: Learn JavaScript For Loops", - "dashedName": "waypoint-learn-javascript-for-loops", - "difficulty": 0.26, - "challengeSeed": ["114614220"], - "description": [ - "Let's learn more about the loops that make virtually all programs possible - the \"For Loop\" and \"While Loop\". First, we'll learn the For Loop.", - "Go to http://www.codecademy.com/courses/javascript-beginner-en-NhsaT/0/1web and complete the section.", - "Be sure to also complete this section: http://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/1." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7132d8c441eddfaeb5bdef", - "name": "Waypoint: Learn JavaScript While Loops", - "dashedName": "waypoint-learn-javascript-while-loops", - "difficulty": 0.27, - "challengeSeed": ["114612889"], - "description": [ - "Go to http://www.codecademy.com/courses/javascript-beginner-en-ASGIv/0/1 and complete the section.", - "Be sure to also complete this section: http://www.codecademy.com/courses/javascript-beginner-en-mrTNH-6VIZ9/0/1." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7133d8c441eddfaeb5bdef", - "name": "Waypoint: Learn Control Flow", - "dashedName": "waypoint-learn-control-flow", - "difficulty": 0.28, - "challengeSeed": ["114612888"], - "description": [ - "Much of human reasoning can be broken down into what we call Boolean Logic. Lucky for us, computers can think the same way! Let's learn how to instruct our computers by writing \"If Statements\" and \"Else Statements\".", - "We'll also learn some advanced \"Control Flow\" principals, such as ways we can exit loops early.", - "Go to http://www.codecademy.com/courses/javascript-beginner-en-qDwp0/0/1 and complete the section.", - "Be sure to also complete this section: http://www.codecademy.com/courses/javascript-beginner-en-ZA2rb/0/1." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7134d8c441eddfaeb5bdef", - "name": "Waypoint: Build a Contact List", - "dashedName": "waypoint-build-a-contact-list", - "difficulty": 0.29, - "challengeSeed": ["114612887"], - "description": [ - "Up to this point, you've been working mostly with strings and numbers. Now we're going to learn more complicated data structures, like \"Arrays\" and \"Objects\".", - "Go to http://www.codecademy.com/courses/javascript-beginner-en-9Sgpi/0/1 and complete the section.", - "Be sure to also complete this section: http://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/1." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7135d8c441eddfaeb5bdef", - "name": "Waypoint: Build an Address Book", - "dashedName": "waypoint-build-an-address-book", - "difficulty": 0.30, - "challengeSeed": ["114612885"], - "description": [ - "Let's learn more about objects.", - "Go to http://www.codecademy.com/courses/spencer-sandbox/0/1 and complete the section.", - "Be sure to also complete this section: http://www.codecademy.com/courses/building-an-address-book/0/1?curriculumid=506324b3a7dffd00020bf661." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7136d8c441eddfaeb5bdef", - "name": "Waypoint: Build a Cash Register", - "dashedName": "waypoint-build-a-cash-register", - "difficulty": 0.31, - "challengeSeed": ["114612882"], - "description": [ - "In this final Codecademy section, we'll learn even more about JavaScript objects.", - "Go to http://www.codecademy.com/courses/objects-ii/0/1 and complete this section.", - "Be sure to also complete the final section: http://www.codecademy.com/courses/close-the-super-makert/0/1." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7138d8c441eddfaeb5bdef", - "name": "Waypoint: Learn Regular Expressions", - "dashedName": "waypoint-learn-regular-expressions", - "difficulty": 0.33, - "challengeSeed": ["112547802"], - "description": [ - "You can use a Regular Expression, or \"Regex\", to select specific types of characters in text.", - "Check out http://www.regexr.com. It's a Regular Expression Sandbox for experimenting with Regular Expressions.", - "Now go to http://www.regexone.com.", - "Note that you can click \"continue\" to move on to the next step as soon as all the tasks have green check marks beside them. You can often do this just by using the wildcard \"dot\" operator, but try to use the techniques that each lesson recommends.", - "Complete \"Complete the 15-lesson tutorial\"", - "Complete \"Complete Practical Example 1: Matching a scientific or decimal number\"", - "Complete \"Complete Practical Example 2: Matching phone numbers\"", - "Complete \"Complete Practical Example 3: Matching emails\"", - "Complete \"Complete Practical Example 4: Matching HTML\"", - "Complete \"Complete Practical Example 5: Matching specific filenames\"", - "Complete \"Complete Practical Example 6: Trimming whitespace from start and end of line\"", - "Once you've completed these challenges, move on to our next Waypoint." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - } - ] -} From aa6a96a4fd6369e2a250faf36a9de20b97b6cd91 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 5 Jul 2015 17:12:52 -0700 Subject: [PATCH 02/13] add basic javascript.json --- challenges/basic-javascript.json | 334 +++++++++++++++++++++++++++++++ 1 file changed, 334 insertions(+) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index e69de29bb2..9a533cfe1c 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -0,0 +1,334 @@ +{ + "name": "Basic JavaScript", + "order": 0.006, + "challenges": [ + { + "_id": "bd7123c9c441eddfaeb5bdef", + "name": "Meet Booleans", + "dashedNname": "waypoint-meet-booleans", + "difficulty": "9.98", + "description": [ + "Return true", + "Some additional directions" + ], + "tests": [ + "expect(welcomeToBooleans()).to.be.a(\"boolean\");", + "expect(welcomeToBooleans()).to.be.true;" + ], + "challengeSeed": [ + "function welcomeToBooleans() {", + "// Good luck!", + "return false;", + "}", + "", + "welcomeToBooleans();" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c442eddfaeb5bdef", + "name": "Define Your Name", + "difficulty": "9.9801", + "description": [ + "Set the value of myName to your name by typing your name in quotes.", + "Currently myName is empty. Type in your name and hit the submit button.", + "Look at the ourName example if you get stuck." + ], + "tests": [ + "expect(myName).to.be.a(\"string\");", + "expect(myName).length.not.to.be(0);" + ], + "challengeSeed": [ + "// ourName = \"Free Code Camp\";", + "myName = \"\";" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c443eddfaeb5bdef", + "name": "Start Using Variables", + "difficulty": "9.9802", + "description": [ + "Now, use the var keyword to create a variable called myName. Set its value to your name.", + "Variables are used to store values.", + "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in camel case. An example of camel case is: camelCase.", + "Look at the ourName example if you get stuck." + ], + "tests": [ + "expect(myName).to.be.a(\"string\");", + "expect(myName).length.not.to.be(0);" + ], + "challengeSeed": [ + "// var ourName = \"Free Code Camp\";", + "" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c444eddfaeb5bdef", + "name": "Define Your First and Last Name", + "difficulty": "9.9803", + "description": [ + "Now, use the var keyword to create a variable called myFirstName and set its value to your first name. Then set a variable called myLastName to your last name.", + "Variables are used to store values.", + "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", + "Look at the ourFirstName and ourLastName examples if you get stuck." + ], + "tests": [ + "expect(myFirstName).to.be.a(\"string\");", + "expect(myFirstName).length.not.to.be(0);", + "expect(myLastName).to.be.a(\"string\");", + "expect(myLastName).length.not.to.be(0);" + ], + "challengeSeed": [ + "// var ourFirstName = \"Free\";", + "// var ourLastName = \"Code Camp\";", + "", + "" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c445eddfaeb5bdef", + "name": "Combine Two Strings into One String", + "difficulty": "9.9804", + "description": [ + "Make a variable called myName by adding the string of your first name to the string of your last name.", + "Strings can be combined in a process called concatenation.", + "Be sure to include a space at the end of your first string. Otherwise the two strings will not have a space between them.", + "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", + "Look at the ourName example if you get stuck." + ], + "tests": [ + "expect(myName).to.be.a(\"string\");", + "expect(myName).length.not.to.be(0);", + "expect((/\\s+/).test(myName)).to.be.true;" + ], + "challengeSeed": [ + "// var ourName = \"Free \" + \"Code Camp\";", + "", + "" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c446eddfaeb5bdef", + "name": "Combine Two Variables into One Variable", + "difficulty": "9.9805", + "description": [ + "Make the variables myFirstName, myLastName, and myFullName. Concatenate my myFirstName to myLastName to create myFullName.", + "Strings can be combined in a process called concatenation.", + "Be sure to include a space at the end of myFirstName. Otherwise myFullName will not contain a space between your first and last names.", + "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", + "Look at the ourFullName example if you get stuck." + ], + "tests": [ + "expect(myFirstName).to.be.a(\"string\");", + "expect(myLastName).to.be.a(\"string\");", + "expect(myFullName).to.be.a(\"string\");", + "expect(myFullName).length.not.to.be(0);", + "expect((/\\s+/).test(myFullName)).to.be.true;" + ], + "challengeSeed": [ + "// var ourFirstName = \"Free \";", + "// var ourLastName = \"Code Camp\";", + "// var ourFullName = ourFirstName + ourLastName;", + "" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c447eddfaeb5bdef", + "name": "Concatenate Both Variables and Strings into the Same Variable", + "difficulty": "9.9806", + "description": [ + "Make the variables myFirstName, myLastName, and myFullName. Concatenate my myFirstName to myLastName to create myFullName, but this time add the space as a separate string, not as part of myFirstName or myLastName.", + "Strings can be combined in a process called concatenation.", + "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", + "Look at the ourFullName example if you get stuck." + ], + "tests": [ + "expect(myFirstName).to.be.a(\"string\");", + "expect(myLastName).to.be.a(\"string\");", + "expect(myFullName).to.be.a(\"string\");", + "expect(myFullName).length.not.to.be(0);", + "expect((/\\s+/).test(myFullName)).to.be.true;" + ], + "challengeSeed": [ + "// var ourFirstName = \"Free\";", + "// var ourLastName = \"Code Camp\";", + "// var ourFullName = ourFirstName + \" \" + ourLastName;", + "" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c448eddfaeb5bdef", + "name": "Check the Length Property of a String Variable", + "difficulty": "9.9809", + "description": [ + "Use the .length property to count the number of characters in the lastNameLength variable.", + "For example, if we created a variable var firstName = \"Julie\", we could find out how long the string \"Julie\" is by using the firstName.length property." + ], + "tests": [ + "expect(lastNameLength).to.equal(4);" + ], + "challengeSeed": [ + "var firstName = \"Madeline\";", + "", + "var firstNameLength = firstName.length;", + "", + "var lastName = \"Chen\";", + "", + "var lastNameLength = lastName;", + "", + "", + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "function returnValue(lastNameLength) {", + " return lastNameLength;", + "}", + "returnValue(lastNameLength);" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c549eddfaeb5bdef", + "name": "Use Bracket Notation to Find the First Character in a String", + "difficulty": "9.9810", + "description": [ + "Use bracket notation to find the first character in a the firstLetterOfLastName variable.", + "Bracket notation is a way to get a character at a specific index within a string.", + "Computers don't start counting at 1 like humans do. They start at 0.", + "For example, the character at index 0 in the word \"Julie\" is \"J\". So if var firstName = \"Julie\", you can get the value of the first letter of the string by using firstName[0].", + "Try looking at the firstLetterOfFirstName variable declaration if you get stuck." + ], + "tests": [ + "expect(firstLetterOfLastName).to.equal('C');" + ], + "challengeSeed": [ + "var firstName = \"Madeline\";", + "", + "var firstLetterOfFirstName = firstName[0];", + "", + "var lastName = \"Chen\";", + "", + "var firstLetterOfLastName = lastName;", + "", + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "function returnValue(firstLetterOfLastName) {", + " return firstLetterOfLastName;", + "}", + "returnValue(firstLetterOfLastName);" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c450eddfaeb5bdef", + "name": "Use Bracket Notation to Find the Nth Character in a String", + "difficulty": "9.9811", + "description": [ + "Use bracket notation to find the 3rd character in the lastName variable.", + "Bracket notation is a way to get a character at a specific index within a string.", + "Computers don't start counting at 1 like humans do. They start at 0.", + "For example, the character at index 0 in the word \"Julie\" is \"J\". So if var firstName = \"Julie\", you can get the value of the first letter of the string by using firstName[0].", + "Try looking at the secondLetterOfFirstName variable declaration if you get stuck." + ], + "tests": [ + "expect(thirdLetterOfLastName).to.equal('e');" + ], + "challengeSeed": [ + "var firstName = \"Madeline\";", + "", + "var secondLetterOfFirstName = firstName[1];", + "", + "var lastName = \"Chen\";", + "", + "var thirdLetterOfLastName = lastName;", + "", + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "function returnValue(thirdLetterOfLastName) {", + " return thirdLetterOfLastName;", + "}", + "returnValue(thirdLetterOfLastName);" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c451eddfaeb5bdef", + "name": "Use Bracket Notation to Find the Last Character in a String", + "difficulty": "9.9812", + "description": [ + "Use bracket notation to find the last character in the lastName variable.", + "For example, the character at index 0 in the word \"Julie\" is \"J\". So if var firstName = \"Julie\", you can get the value of the first letter of the string by using firstName[0].", + "In order to get the last letter of a string, you can subtract one from the string's length.", + "For example, if var firstName = \"Julie\", you can get the value of the last letter of the string by using firstName[firstName.length - 1].", + "Try looking at the lastLetterOfLastName variable declaration if you get stuck." + ], + "tests": [ + "expect(lastLetterOfLastName).to.equal('n');" + ], + "challengeSeed": [ + "var firstName = \"Madeline\";", + "", + "var lastLetterOfFirstName = firstName[firstName.length - 1];", + "", + "var lastName = \"Chen\";", + "", + "var lastLetterOfLastName = lastName;", + "", + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "function returnValue(lastLetterOfLastName) {", + " return lastLetterOfLastName;", + "}", + "returnValue(lastLetterOfLastName);" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c452eddfaeb5bdef", + "name": "Use Bracket Notation to Find the Nth to Last Character in a String", + "difficulty": "9.9813", + "description": [ + "Use bracket notation to find the second-to-last character in the lastName variable.", + "For example, the character at index 0 in the word \"Julie\" is \"J\". So if var firstName = \"Julie\", you can get the value of the first letter of the string by using firstName[0].", + "In order to get the last letter of a string, you can subtract one from the string's length.", + "For example, if var firstName = \"Julie\", you can get the value of the third-to-last letter of the string by using firstName[firstName.length - 3].", + "Try looking at the lastLetterOfLastName variable declaration if you get stuck." + ], + "tests": [ + "expect(secondToLastLetterOfLastName).to.equal('e');" + ], + "challengeSeed": [ + "var firstName = \"Madeline\";", + "", + "var thirdToLastLetterOfFirstName = firstName[firstName.length - 2];", + "", + "var lastName = \"Chen\";", + "", + "var secondToLastLetterOfLastName = lastName;", + "", + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "function returnValue(secondToLastLetterOfLastName) {", + " return secondToLastLetterOfLastName;", + "}", + "returnValue(secondToLastLetterOfLastName);" + ], + "challengeType": 1 + } + ] +} From b117341e72fc2d8bcfe56bf98ab83a1a91050812 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Thu, 9 Jul 2015 00:26:16 +0100 Subject: [PATCH 03/13] Update 2 of the new js curriculum! 7 more challenges added! --- challenges/basic-javascript.json | 683 +++++++++++++++++++++++++------ 1 file changed, 553 insertions(+), 130 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 9a533cfe1c..836e2d5285 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -2,18 +2,47 @@ "name": "Basic JavaScript", "order": 0.006, "challenges": [ + { + "_id":"bd7123c9c441eddfaeb4bdef", + "name":"Welcome To Comments", + "dashedName":"waypoint-welcome-to-comments", + "difficulty":"9.98", + "description":[ + "", + "A comment is a very useful line of code that is not actually ran by the machine executing it. With this property comments are the perfect way of creating notes to yourself or anyone else who reads your code describing what the code does", + "It's an extremely important part in writing good, efficient and maintainable code and a requirement by most employers", + "Let's take a look at the two ways in which we can write a comment in JavaScript", + " //This is a comment ", + "These comment out the entire line that they are on", + " /*This also is a comment*/ ", + "These comment out everything in between /* and */ ", + "Try creating one of each now." + ], + "tests":[ + "assert(editor.getValue().match(/(\\/\\*)...../g), 'Make sure you have at least one \/\\* \\*\/ style comment that has at least three letters in it');", + "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the coment with a \\*\/');", + "assert(editor.getValue().match(/(\\/\\/)...../g), 'Make sure that there is at least one \\/\\/ style comment with at least three letters in it');" + ], + "challengeSeed":[ + + ], + "challengeType": 1 + }, { "_id": "bd7123c9c441eddfaeb5bdef", - "name": "Meet Booleans", - "dashedNname": "waypoint-meet-booleans", - "difficulty": "9.98", + "name": "Unconditionally Loving Booleans", + "dashedName": "waypoint-unconditionally-loving-booleans", + "difficulty": "9.98001", "description": [ "Return true", - "Some additional directions" + "A boolean is a type of variable that represents either true or false (Named after the British mathematician George Boole).", + "Booleans are often the result of a function or a comparative operation, for example 1==1 is true whereas 1==2 is false.", + "They are most commonly found inside if statements which we shall cover later", + "For now Let's modify our welcomeToBooleans function so that it will return true instead of false when the run button is clicked" ], "tests": [ - "expect(welcomeToBooleans()).to.be.a(\"boolean\");", - "expect(welcomeToBooleans()).to.be.true;" + "assert(typeof(welcomeToBooleans())=='boolean', 'The value returned by welcomeToBooleans() should be a boolean value. (true of false)');", + "assert(welcomeToBooleans() == true, 'The value returned by welcomeToBooleans() should be true');" ], "challengeSeed": [ "function welcomeToBooleans() {", @@ -25,153 +54,146 @@ ], "challengeType": 1 }, - { - "_id": "bd7123c9c442eddfaeb5bdef", - "name": "Define Your Name", - "difficulty": "9.9801", - "description": [ - "Set the value of myName to your name by typing your name in quotes.", - "Currently myName is empty. Type in your name and hit the submit button.", - "Look at the ourName example if you get stuck." - ], - "tests": [ - "expect(myName).to.be.a(\"string\");", - "expect(myName).length.not.to.be(0);" - ], - "challengeSeed": [ - "// ourName = \"Free Code Camp\";", - "myName = \"\";" - ], - "challengeType": 1 - }, { "_id": "bd7123c9c443eddfaeb5bdef", "name": "Start Using Variables", - "difficulty": "9.9802", + "dashedName": "waypoint-start-using-variables", + "difficulty": "9.9801", "description": [ + "", "Now, use the var keyword to create a variable called myName. Set its value to your name.", "Variables are used to store values.", + "The name variable comes from the fact that it's value, varies!", + "Now Let's create our first variable called myName and because it's a name let's make it a string!", "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in camel case. An example of camel case is: camelCase.", "Look at the ourName example if you get stuck." ], "tests": [ - "expect(myName).to.be.a(\"string\");", - "expect(myName).length.not.to.be(0);" + "assert(typeof(myName) == 'string', \"You're new variable should be a string\");", + "assert(myName.length > 0, \"You're string should have something in it!\");" ], "challengeSeed": [ "// var ourName = \"Free Code Camp\";", - "" + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "(function(v){return(v);})(ourName);" + ], + "challengeType": 1 + }, + { + "_id": "bd7123c9c442eddfaeb5bdef", + "name": "Define Your Name", + "dashedName": "waypoint-define-your-name", + "difficulty": "9.9802", + "description": [ + "", + "In this challenge we are going to take a look at strings.", + "Strings are a data type for words and sentences", + "Now we are going to set the value of myName to your name by typing your name in quotes.", + "Currently myName is empty. Type in your name and hit the submit button.", + "Look at the ourName example if you get stuck." + ], + "tests": [ + "assert(typeof(myName) == 'string', 'The variable myName should be a string');", + "assert(myName.length > 0, 'Give the string myName a value');" + ], + "challengeSeed": [ + "// ourName = \"Free Code Camp\";", + "myName = \"\";", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "(function(v){return(v);})(myName);" ], "challengeType": 1 }, { "_id": "bd7123c9c444eddfaeb5bdef", "name": "Define Your First and Last Name", - "difficulty": "9.9803", + "dashedName": "waypoint-define-your-first-and-last-name", + "difficulty": "9.9804", "description": [ - "Now, use the var keyword to create a variable called myFirstName and set its value to your first name. Then set a variable called myLastName to your last name.", - "Variables are used to store values.", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourFirstName and ourLastName examples if you get stuck." + "", + "Programs will almost always have several different variables that are used to keep track of several different pieces of data", + "We are now going to go and create two new variables myFirstName and myLastName that are strings", + "You can assign these variables to be equal to your first and last names respectively." ], "tests": [ - "expect(myFirstName).to.be.a(\"string\");", - "expect(myFirstName).length.not.to.be(0);", - "expect(myLastName).to.be.a(\"string\");", - "expect(myLastName).length.not.to.be(0);" + "assert(typeof(myFirstName) == 'string', 'myFirstName should be set to a string');", + "assert(typeof(myLastName) == 'string', 'myLastName should be set to a string');", + "assert(myFirstName.length > 0, 'myFirstName Should not be empty');", + "assert(myLastName.length > 0, 'myLastName should not be empty');", + "assert(typeof(myName) == 'string', 'The variable myName should be a string');", + "assert(myName.length > 0, 'Give the string myName a value');" ], "challengeSeed": [ + "// ourName = \"Free Code Camp\";", "// var ourFirstName = \"Free\";", "// var ourLastName = \"Code Camp\";", "", - "" + "var myName = \"\";", + "", + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "(function(v){return(v);})(myName);" ], "challengeType": 1 }, { "_id": "bd7123c9c445eddfaeb5bdef", "name": "Combine Two Strings into One String", - "difficulty": "9.9804", + "dashedName": "waypoint-combine-two-variables-into-one-string", + "difficulty": "9.9805", "description": [ "Make a variable called myName by adding the string of your first name to the string of your last name.", "Strings can be combined in a process called concatenation.", - "Be sure to include a space at the end of your first string. Otherwise the two strings will not have a space between them.", + "We are now going to take the two variables myFirstName and myLastName and assign them values", + "Once we have given values to our two variables we can now concatenate them together with a space in between them", "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", "Look at the ourName example if you get stuck." ], "tests": [ - "expect(myName).to.be.a(\"string\");", - "expect(myName).length.not.to.be(0);", - "expect((/\\s+/).test(myName)).to.be.true;" - ], - "challengeSeed": [ - "// var ourName = \"Free \" + \"Code Camp\";", - "", - "" - ], - "challengeType": 1 - }, - { - "_id": "bd7123c9c446eddfaeb5bdef", - "name": "Combine Two Variables into One Variable", - "difficulty": "9.9805", - "description": [ - "Make the variables myFirstName, myLastName, and myFullName. Concatenate my myFirstName to myLastName to create myFullName.", - "Strings can be combined in a process called concatenation.", - "Be sure to include a space at the end of myFirstName. Otherwise myFullName will not contain a space between your first and last names.", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourFullName example if you get stuck." - ], - "tests": [ - "expect(myFirstName).to.be.a(\"string\");", - "expect(myLastName).to.be.a(\"string\");", - "expect(myFullName).to.be.a(\"string\");", - "expect(myFullName).length.not.to.be(0);", - "expect((/\\s+/).test(myFullName)).to.be.true;" - ], - "challengeSeed": [ - "// var ourFirstName = \"Free \";", - "// var ourLastName = \"Code Camp\";", - "// var ourFullName = ourFirstName + ourLastName;", - "" - ], - "challengeType": 1 - }, - { - "_id": "bd7123c9c447eddfaeb5bdef", - "name": "Concatenate Both Variables and Strings into the Same Variable", - "difficulty": "9.9806", - "description": [ - "Make the variables myFirstName, myLastName, and myFullName. Concatenate my myFirstName to myLastName to create myFullName, but this time add the space as a separate string, not as part of myFirstName or myLastName.", - "Strings can be combined in a process called concatenation.", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourFullName example if you get stuck." - ], - "tests": [ - "expect(myFirstName).to.be.a(\"string\");", - "expect(myLastName).to.be.a(\"string\");", - "expect(myFullName).to.be.a(\"string\");", - "expect(myFullName).length.not.to.be(0);", - "expect((/\\s+/).test(myFullName)).to.be.true;" + "assert(typeof(myFirstName) == 'string', 'myFirstName should be set to a string');", + "assert(typeof(myLastName) == 'string', 'myLastName should be set to a string');", + "assert(myFirstName.length > 0, 'myFirstName Should not be empty');", + "assert(myLastName.length > 0, 'myLastName should not be empty');", + "assert(typeof(myName) == 'string', 'myName should be a string');", + "assert(myName.length > 0, \"You're string should have something in it!\");", + "assert((/\\s+/).test(myName) == true, 'myName shuold contain a space');" ], "challengeSeed": [ "// var ourFirstName = \"Free\";", "// var ourLastName = \"Code Camp\";", - "// var ourFullName = ourFirstName + \" \" + ourLastName;", - "" + "// var ourName = ourFirstName + \" \" + ourLastName;", + "", + "var myFirstName = \"\";", + "var myLastName = \"\";", + "var myName;", + "", + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "(function(v){return(v);})(myName);" ], "challengeType": 1 }, { "_id": "bd7123c9c448eddfaeb5bdef", "name": "Check the Length Property of a String Variable", + "dashedName": "waypoint-check-the-length-property-of-a-string-variable", "difficulty": "9.9809", "description": [ + "", "Use the .length property to count the number of characters in the lastNameLength variable.", "For example, if we created a variable var firstName = \"Julie\", we could find out how long the string \"Julie\" is by using the firstName.length property." ], "tests": [ - "expect(lastNameLength).to.equal(4);" + "assert(lastNameLength == 4, 'lastNameLength should have a length of 4');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -187,16 +209,14 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "function returnValue(lastNameLength) {", - " return lastNameLength;", - "}", - "returnValue(lastNameLength);" + "(function(v){return(v);})(lastNameLength);" ], "challengeType": 1 }, { "_id": "bd7123c9c549eddfaeb5bdef", "name": "Use Bracket Notation to Find the First Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-first-character-in-a-string", "difficulty": "9.9810", "description": [ "Use bracket notation to find the first character in a the firstLetterOfLastName variable.", @@ -206,7 +226,7 @@ "Try looking at the firstLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "expect(firstLetterOfLastName).to.equal('C');" + "assert(firstLetterOfLastName == 'C', 'The first letter of firstLetterOfLastName should be a C');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -221,26 +241,23 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "function returnValue(firstLetterOfLastName) {", - " return firstLetterOfLastName;", - "}", - "returnValue(firstLetterOfLastName);" + "(function(v){return(v);})(firstLetterOfLastName);" ], "challengeType": 1 }, { "_id": "bd7123c9c450eddfaeb5bdef", "name": "Use Bracket Notation to Find the Nth Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-nth-character-in-a-string", "difficulty": "9.9811", "description": [ - "Use bracket notation to find the 3rd character in the lastName variable.", - "Bracket notation is a way to get a character at a specific index within a string.", - "Computers don't start counting at 1 like humans do. They start at 0.", - "For example, the character at index 0 in the word \"Julie\" is \"J\". So if var firstName = \"Julie\", you can get the value of the first letter of the string by using firstName[0].", + "Just like the last lesson where we used Bracket Notation to access the first letter we can use the same method to get the letters ar other positions", + "Don't forget that computers start counting at 0 so the first letter is actually the zeroth one", + "Let's now try to set thirdLetterOfLastName to equal the third letter of the lastName variable", "Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "expect(thirdLetterOfLastName).to.equal('e');" + "assert(thirdLetterOfLastName == 'e', thirdLetterOfLastName);" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -255,16 +272,14 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "function returnValue(thirdLetterOfLastName) {", - " return thirdLetterOfLastName;", - "}", - "returnValue(thirdLetterOfLastName);" + "(function(v){return(v);})(thirdLetterOfLastName);" ], "challengeType": 1 }, { "_id": "bd7123c9c451eddfaeb5bdef", "name": "Use Bracket Notation to Find the Last Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-last-character-in-a-string", "difficulty": "9.9812", "description": [ "Use bracket notation to find the last character in the lastName variable.", @@ -274,7 +289,7 @@ "Try looking at the lastLetterOfLastName variable declaration if you get stuck." ], "tests": [ - "expect(lastLetterOfLastName).to.equal('n');" + "assert(lastLetterOfLastName == 'n', 'lastLetterOfLastName should be n');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -286,19 +301,14 @@ "var lastLetterOfLastName = lastName;", "", "", - "// You can ignore this.", - "// We use this to show you the value of your variable in your output box.", - "// We'll learn about functions soon.", - "function returnValue(lastLetterOfLastName) {", - " return lastLetterOfLastName;", - "}", - "returnValue(lastLetterOfLastName);" + "(function(v){return(v);})(lastLetterOfLastName);" ], "challengeType": 1 }, { "_id": "bd7123c9c452eddfaeb5bdef", "name": "Use Bracket Notation to Find the Nth to Last Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-nth-to-last-character-in-a-string", "difficulty": "9.9813", "description": [ "Use bracket notation to find the second-to-last character in the lastName variable.", @@ -308,7 +318,7 @@ "Try looking at the lastLetterOfLastName variable declaration if you get stuck." ], "tests": [ - "expect(secondToLastLetterOfLastName).to.equal('e');" + "assert(secondToLastLetterOfLastName == 'e', 'secondToLastLetterOfLastName should be e');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -320,13 +330,426 @@ "var secondToLastLetterOfLastName = lastName;", "", "", - "// You can ignore this.", - "// We use this to show you the value of your variable in your output box.", - "// We'll learn about functions soon.", - "function returnValue(secondToLastLetterOfLastName) {", - " return secondToLastLetterOfLastName;", + "(function(v){return(v);})(secondToLastLetterOfLastName);" + ], + "challengeType": 1 + }, + { + "_id": "bd7993c9c69feddfaeb6bdef", + "name": "Magical Maths", + "dashedName": "waypoint-magical-maths", + "difficulty": "9.9814", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use + for addition", + "We use - for subtraction", + "We use * for multiplication", + "We use / for division", + "Replace the _ with correct number to achieve the result in the comment." + ], + "tests": [ + "assert(add==20, 'The result of the sum in add should be 20');", + "assert(subtract==12, 'The result of the sum in add should be 12');", + "assert(multiply==80, 'The result of the sum in add should be 80');", + "assert(divide==2, 'The result of the sum in add should be 2');" + ], + "challengeSeed": [ + "var add = 10 + _;//equals 20", + "var subtract = 45 - _;//equals 12", + "var multiply = 8 * _;//equals 80", + "var divide = 66 / _;//equals 2", + "", + "", + "", + "(function(w,x,y,z){return('add='+w+', subtract='+x+', multiply='+y+', divide='+z);})(add,subtract,multiply,divide);" + ], + "challengeType": 1 + }, + { + "_id": "bd7993c9c69feddfaeb7bdef", + "name": "Working With Decimals", + "dashedName": "waypoint-working-with-decimals", + "difficulty": "9.9815", + "description": [ + "", + "in JavaScript we can can work with decimal numbers", + "These decal numbers are known as floats.", + "Let's take a look at working with floats now" + ], + "tests": [ + "assert(add == 13.5, 'The result of add should be 13.5');", + "assert(subtract == 7.25, 'The result of subtract should be 7.25');", + "assert(multiply == 15, 'The result of multiply should be 3.75');", + "assert(divide == 2.25, 'The result of divide should be 2.25');" + ], + "challengeSeed": [ + "var add = 9 + _;//equals 13.5", + "var subtract = 12 - _;//equals 7.25", + "var multiply = 3.75 * _;//equals 15", + "var divide = 9 / _;//equals 2.25", + "", + "", + "", + "(function(w,x,y,z){return('add='+w+', subtract='+x+', multiply='+y+', divide='+z);})(add,subtract,multiply,divide);" + ], + "challengeType": 1 + }, + { + "_id": "bd7993c9c69feddfaeb8bdef", + "name": "An Array Of new Information", + "dashedName": "waypoint-an-array-of-new-information", + "difficulty": "9.9816", + "description": [ + "", + "In JavaScript we can store lists or collections of data in what are called arrays", + "Arrays are distinguished by the [ and ] around the data. Each piece of data is separated be a , ", + "Now let's create a new array called myArray with a string , a number and a array with a , separating each one", + "Refer to the example if you get stuck", + "" + ], + "tests": [ + "assert(typeof(myArray) == 'object', 'myArray should be an array');", + "assert(myArray[0] !== undefined && typeof(myArray[0]) == 'string', 'The fist item in myArray should be a string');", + "assert(myArray[1] !== undefined && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number');", + "assert(myArray[2] !== undefined && typeof(myArray[2]) == 'object', 'The third item in myArray should be an array');" + ], + "challengeSeed": [ + "//var array = ['John', 23, [2, 'cat']];", + "", + "var myArray = [];", + "", + "", + "(function(z){return(z);})(myArray);" + ], + "challengeType": 1 + }, + { + "_id": "bg9994c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With pop()", + "dashedName": "waypoint-manipulating-arrays-with-pop", + "difficulty": "9.9817", + "description": [ + "", + "When and array has been defined we still have the ability to make changes to it afterwards", + "One common way in which we can manipulate the data in an array is through .pop() ", + " .pop() is used to \"pop\" a value from the end of an array. We can retrieve this value by preforming the pop in a variable declaration.", + "any type of variable can be \"popped\" from and array", + "Let's try .pop() now" + ], + "tests": [ + "assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');", + "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return(true);}else{return(false);}})(removed), 'myArray should only have the first two values left([\"cat\"], 2)');" + ], + "challengeSeed": [ + "//var numbers = [1,2,3];", + "//console.log(numbers); //Gives [1,2,3]", + "//var removed = numbers.pop();", + "//console.log(numbers); //Gives [1,2]", + "//console.log(removed); //Gives 3", + "", + "var myArray = ['John', 23, ['cat', 2]];", + "var removed = _;//This should be ['cat', 2] and myArray should now be ['John', 23]", + "", + "", + "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);" + ], + "challengeType": 1 + }, + { + "_id": "bg9995c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With push()", + "dashedName": "waypoint-manipulating-arrays-with-push", + "difficulty": "9.9818", + "description": [ + "", + "Now that we've learn how to pop things from the end of the array, we need to learn how to push stuff back to the end", + "Let's take the code we had last time and push this value to the end: ['dog', 3] " + ], + "tests": [ + "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]])');" + ], + "challengeSeed": [ + "var myArray = ['John', 23, ['cat', 2]];", + "var removed = myArray.pop();", + "//Add a ['dog', 3] to the end of myArray using push", + "", + "", + "(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);" + ], + "challengeType": 1 + }, + { + "_id": "bg9996c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With shift()", + "dashedName": "waypoint-manipulating-arrays-with-shift", + "difficulty": "9.9817", + "description": [ + "", + "Another common way in which we can manipulate the data in an array is through .shift() ", + " .shift() is used to \"shift\" a value from the start of an array. We can retrieve this value by preforming the shift in a variable declaration.", + "Let's try .shift() now" + ], + "tests": [ + "assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');", + "assert((function(d){if(d == 'John'){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');" + ], + "challengeSeed": [ + "var myArray = ['John', 23, ['dog', 3]];", + "var removed = _;//This should be ['John'] and myArray should now be ['John', 23]", + "", + "", + "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);" + ], + "challengeType": 1 + }, + { + "_id": "bg9997c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With unshift()", + "dashedName": "waypoint-manipulating-arrays-with-unshift", + "difficulty": "9.9818", + "description": [ + "", + "Now that we've learned how to shift things from the start of the array, we need to learn how to unshift stuff back to the start", + "Let's take the code we had last time and unshift this value to the end: 'Paul' " + ], + "tests": [ + "assert((function(d){if(d[0].toLowerCase() == 'paul' && d[1] == 23 && d[2][0] != undefined && d[2][0] == 'dog' && d[2][1] != undefined && d[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should now have [\"Paul\", 23, [\"dog\", 3]])');" + ], + "challengeSeed": [ + "var myArray = ['John', 23, ['dog', 3]];", + "var removed = myArray.shift();//This should be 'John' and myArray should now be [23, ['dog', 3]]", + "//Add 'Paul' to the start of myArray", + "", + "", + "(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);" + ], + "challengeType": 1 + }, + { + "_id":"bg9997c9c79feddfaeb9bdef", + "name":"Manipulating Arrays Indexes", + "dashedName":"waypoint-manipulating-arrays-indexes", + "difficulty":"9.9818", + "description":[ + "", + "With Arrays, we can access and modify the data inside them using indexes much like we did with strings. The major difference between using indexes with arrays versus using them in strings is that you cannot modify data in a string using and index.", + "In Arrays though we are freely allowed to change values in an array.", + "Let's have a go and accessing the last item in myArray and changing the middle value tp 25 ", + "Take a look at the commented out example above if you get stuck" + ], + "tests":[ + "assert((function(a){if(a[0] != undefined && a[0] == 'Paul' && a[1] != undefined && a[1] == 25 && a[2][0] != undefined && a[2][0] == 'dog' && a[2][1] != undefined && a[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should be [\"John\", \"David\",\"Paul\"]');", + "assert((function(l){if(l[0] != undefined && l[0] == 'dog' && l[1] != undefined && l[1] == 3){return(true);}else{return(false);}})(last), 'The last variable in myArray should be [\"dog\", 3]');" + ], + "challengeSeed":[ + "//var ourArray = ['Alpha', 'Beta', 'Gamma'];", + "//ourArray[0];//the first item in the array is 'Alpha'", + "//ouArray[1] = 'Omega';//The second item int the array is nom Omega instead of Beta", + "", + "var myArray = ['Paul', 23, ['dog', 3]];", + "var last = _;//Set this to be the last variable in the array using an index", + "", + "//Now set the second item in the Array to be 25 using an index'", + "", + "", + "", + "(function(y,z){return('myArray = ' + JSON.stringify(y) + ', last = ' + JSON.stringify(z));})(myArray, last);" + ], + "challengeType": 1 + }, + { + "_id":"bg9997c9c89feddfaeb9bdef", + "name":"Make it functional", + "dashedName":"waypoint-make-it-functional", + "difficulty":"9.9819", + "description":[ + "", + "In JavaScript we can divide up our code into separate and reusable parts called functions", + "here's and example of a function", + "", + "function funcitonName (one, two ,three){", + " /*Some Code*/", + "}", + "", + "our function can be called like this", + "functionName();", + "Let's try creating and calling a function now." + ], + "tests":[ + "assert(f==data);" + ], + "challengeSeed":[ + "//var ourData = 'function called!';", + "//function ourFunction(ourData) {/*ourData is being passed to this function as an argument*/", + "//return(data);", + "//}", + "", + "var data = 'Function Called!';", + "", + "//Create a function called myFunction that takes data as an argument and returns it like the example above", + "", + "", + "", + "", + "", + "//Don't modify this!", + "var f=myFunction(data);", + "(function(){var f=myFunction(data);return(f);})('');" + ], + "challengeType": 1 + }, + { + "_id":"bg9997c9c99feddfaeb9bdef", + "name":"Doing things inside functions", + "dashedName":"waypoint-doing-things-inside-functions", + "difficulty":"9.982", + "description":[ + "", + "A function that takes the value you give it and returns it isn't very useful! So now let's get our functions to do something!", + "Starting from where we were last time let's make our function revers whatever we give it by chaining .split('') , .reverse() and .join('') " + ], + "tests":[ + "assert(f==data.split('').reverse().join(''), 'myFunction should now return the reversed version of data (!dellaC noitcnuF)');" + ], + "challengeSeed":[ + "//You can reverse strings like this", + "//var notReversed = 'String';", + "//var reversed = notReversed.split('').reverse().join('');", + "", + "var data = 'Function Called!';", + "", + "function myFunction(data){", + " ", + " return(data);", "}", - "returnValue(secondToLastLetterOfLastName);" + "", + "", + "", + "//Don't modify this!", + "var f=myFunction(data);", + "(function(f){return(f);})(f);" + ], + "challengeType": 1 + }, + { + "_id":"bg9997c9c99feddfaeb9bdef", + "name":"Keeping In The Scope Of Things", + "dashedName":"waypoint-keeping-in-the-scope-of-things", + "difficulty":"9.9821", + "description":[ + "", + "All variables are contained in something called a scope .", + "A Scope defines where are variable can be accessed.", + "All variables created outside any functions exist in what is called the global scope ", + "All variables are container or are scope to inside that function.", + "", + "var variable = 'Global Scope'", + "function test(){", + " return(variable);", + "}", + "test();//Returns Global Scope", + "", + "function change(){", + " variable = 'test';", + " return(variable);", + "}", + "", + "change();//Returns test", + "variable //equals Global Scope", + "", + "", + "Let's give this a go!" + ], + "tests":[ + "assert(Global == access(Global), 'access should return your Global var');", + "assert(Global != localChange(Global), 'localChange should return your Global var');" + ], + "challengeSeed":[ + "//Create Your global variable with any value here", + "var Global = _;", + "", + "//Make access() return you global variable", + "function access(){", + " ", + "}", + "", + "access();", + "", + "//Pass you global variable into localChange and modify it within the function", + "function localChange(){", + " ", + "}", + "", + "//Don't forget to call localChange here and pass your global variable", + "", + "", + "(function(x,y,z){return('access returns: ' + y(x) + ' & localChange returns: ' + z(x));})(Global, access, localChange);" + ], + "challengeType": 1 + }, + { + "_id":"bg9998c9c99feddfaeb9bdef", + "name":"I Object!", + "dashedName":"waypoint-i-object", + "difficulty":"9.9822", + "description":[ + "", + "A very important data type in javascript is the Object ", + " Objects a similar to arrays except that instead of using indexes to access and modify their data, Objects have what are called properties ", + "Here's a sample Object", + "", + "var cat = {", + " \"name\": \"Whiskers\",", + " \"legs\": 4,", + " \"tails\": 1,", + " \"enemies\": [\"Water\", \"Dogs\"]", + "};", + "", + "Objects are useful for storing data in a structured way or in a way that represents a real world object like a cat.", + "Let's try to make a Object that represents a dog called myDog!" + + ], + "tests":[ + "assert((function(z){if(z.hasOwnProperty('name') && z.name != undefined && typeof(z.name) == 'string'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property name and it should be a string');", + "assert((function(z){if(z.hasOwnProperty('legs') && z.legs != undefined && typeof(z.legs) == 'number'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property legs and it should be a number');", + "assert((function(z){if(z.hasOwnProperty('tails') && z.tails != undefined && typeof(z.tails) == 'number'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property tails and it should be a number');", + "assert((function(z){if(z.hasOwnProperty('friends') && z.friends != undefined && Array.isArray(z.friends)){return(true);}else{return(false);}})(myDog), 'myDog should contain the property friends and it should be an array');" + ], + "challengeSeed":[ + "//var ourDog = {", + " //\"name\": \"Camper\"", + " //\"legs\": 4", + " //\"tails\": 1", + " //\"friends\": ['everything!']", + "//};", + "", + "/* add the name(string), legs(number), tails(number) and friends(array) properties to myDog.", + "You can set them to whatever you want!*/", + "", + "var myDog = {", + " ", + "};", + "", + "(function(z){return(z);})(myDog);" + ], + "challengeType": 1 + }, + { + "_id":"bg9999c9c99feddfaeb9bdef", + "name":"Manipulating Objects", + "dashedName":"waypoint-manipulating-objects", + "difficulty":"9.9823", + "description":[ + "", + "" + ], + "tests":[ + "assert(1==2);" + ], + "challengeSeed":[ + "" ], "challengeType": 1 } From 35fff3ed5718e4dbfd98ad61495b36b81bdea5c5 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 10 Jul 2015 00:56:30 +0100 Subject: [PATCH 04/13] Third commit to the new curriculum --- challenges/basic-javascript.json | 224 ++++++++++++++++++++++++++++++- 1 file changed, 219 insertions(+), 5 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 836e2d5285..8a2cc64030 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -719,10 +719,10 @@ ], "challengeSeed":[ "//var ourDog = {", - " //\"name\": \"Camper\"", - " //\"legs\": 4", - " //\"tails\": 1", - " //\"friends\": ['everything!']", + "// \"name\": \"Camper\"", + "// \"legs\": 4", + "// \"tails\": 1", + "// \"friends\": ['everything!']", "//};", "", "/* add the name(string), legs(number), tails(number) and friends(array) properties to myDog.", @@ -743,12 +743,226 @@ "difficulty":"9.9823", "description":[ "", + "Now that we have an objects we need to know how to add and remove properties from it", + "We add properties to objects like this", + "myObject['myProperty'] = \"myValue\";", + "They can also be deleted like this", + "delete(myObject[\"myProperty\"]);", + "Let's add the property bark", "" ], "tests":[ - "assert(1==2);" + "assert(myDog.bark != undefined, 'The property tails should have been deleted');", + "assert(myDog.tails == undefined, 'The property tails should have been deleted');" ], "challengeSeed":[ + "//var ourDog = {", + "//\"name\": \"Camper\"", + "//\"legs\": 4", + "//\"tails\": 1", + "//\"friends\": [\"everything!\"]", + "//};", + "", + "//Re-create myDog", + "", + "var myDog = {", + " \"name\": _,", + " \"legs\": _,", + " \"tails\": _,", + " \"friends\": []", + "};", + "", + "//Let's add the property age to myDog", + "", + "", + "//Now delete the property tails", + "", + "", + "(function(z){return(z);})(myDog);" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb5bdef", + "name":"Looping with for", + "dashedName":"waypoint-looping-with-for", + "difficulty":"9.9824", + "description":[ + "", + "Loops are a critical part of any program! The next few challenges", + "first we will be taking a look at the for loop", + "", + "var ourArray = [];", + "for(var i = 0; i < 5; i++){", + " ourArray.push(i);", + "}", + "", + "ourArray now contains [0,1,2,3,4] ", + "Let's try getting a for loop to work by pushing values to an array" + ], + "tests":[ + "assert(editor.getValue().match(/for\\(/g), 'You should be using a for loop for this!');", + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb1bdef", + "name":"Looping with while", + "dashedName":"waypoint-looping-with-while", + "difficulty":"9.9825", + "description":[ + "", + "Loops are a critical part of any program! The next few challenges", + "first we will be taking a look at the for loop", + "", + "var ourArray = [];", + "var i = 0;", + "while(i < 5){", + " ourArray.push(i);", + " i++;", + "}", + "", + "Let's try getting a for loop to work by pushing values to an array" + ], + "tests":[ + "assert(editor.getValue().match(/while\\(/g), 'You should be using a while loop for this!');", + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb2bdef", + "name":"Looping with do while", + "dashedName":"waypoint-looping-with-do-while", + "difficulty":"9.9826", + "description":[ + "", + "Let's now take a look at the do - while loop", + "", + "var ourArray = [];", + "var i = 0;", + "do{", + " ourArray.push(i);", + " i++;", + "}while(i<5);", + "", + "A do - while has a very special difference when compared to the for and while loops. The do while loop is guaranteed to execute preform it's action once regardless of whether or not the condition inside the while is met!", + "Let's try getting a do - while loop to work by pushing values to an array" + ], + "tests":[ + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');", + "assert((function(){if(editor.getValue().match(/do/g) && editor.getValue(/while/g).match()){return(true);}else{return(false);}})(), 'You should be using a do while loop for this!');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb3bdef", + "name":"Looping with recursion", + "dashedName":"waypoint-looping-with-recursion", + "difficulty":"9.9827", + "description":[ + "", + "The next method of looping that we'll examine is called recursion", + "A recursive function (a function that uses recursion) is a function that calls itself until a predefined condition is met", + "", + "var ourArray = [];", + "var i = 0;", + "function loop(){", + " ourArray.push(i);", + " i++;", + " if(i < 5){", + " loop()", + " }", + "}", + "", + "ourArray now contains [0,1,2,3,4] ", + "Let's try getting recursion to work by pushing values to an array" + ], + "tests":[ + "assert((function(){if(!editor.getValue().match(/do/g) && !editor.getValue().match(/while/g) && !editor.getValue().match(/for/g)){return(true);}else{return(false);}})(), 'You should be using recursion for this!')", + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb4bdef", + "name":"Looping with map", + "dashedName":"waypoint-looping-with-map", + "difficulty":"9.9828", + "description":[ + "", + "Loops are a critical part of any program! The next few challenges", + "first we will be taking a look at the for loop", + "", + "var ourArray = [];", + "for(var i = 0; i < 5; i++){", + " ourArray.push(i);", + "}", + "", + "ourArray now contains [0,1,2,3,4] ", + "Let's try getting a for loop to work by pushing values to an array" + ], + "tests":[ + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb6bdef", + "name":"Looping with reduce", + "dashedName":"waypoint-looping-with-reduce", + "difficulty":"9.9829", + "description":[ + "", + "Loops are a critical part of any program! The next few challenges", + "first we will be taking a look at the for loop", + "", + "var ourArray = [];", + "for(var i = 0; i < 5; i++){", + " ourArray.push(i);", + "}", + "", + "ourArray now contains [0,1,2,3,4] ", + "Let's try getting a for loop to work by pushing values to an array" + ], + "tests":[ + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", "" ], "challengeType": 1 From 4060d7fdc952a0ce4130df233d6a02d696905de1 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 10 Jul 2015 17:22:58 +0100 Subject: [PATCH 05/13] Update to 30! --- challenges/basic-javascript.json | 58 -------------------------------- 1 file changed, 58 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 8a2cc64030..9a50f07b5c 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -908,64 +908,6 @@ "" ], "challengeType": 1 - }, - { - "_id":"bh1111c1c11feddfaeb4bdef", - "name":"Looping with map", - "dashedName":"waypoint-looping-with-map", - "difficulty":"9.9828", - "description":[ - "", - "Loops are a critical part of any program! The next few challenges", - "first we will be taking a look at the for loop", - "", - "var ourArray = [];", - "for(var i = 0; i < 5; i++){", - " ourArray.push(i);", - "}", - "", - "ourArray now contains [0,1,2,3,4] ", - "Let's try getting a for loop to work by pushing values to an array" - ], - "tests":[ - "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" - ], - "challengeSeed":[ - "var myArray = [];", - "//Push the numbers 0-4 to myArray", - "", - "" - ], - "challengeType": 1 - }, - { - "_id":"bh1111c1c11feddfaeb6bdef", - "name":"Looping with reduce", - "dashedName":"waypoint-looping-with-reduce", - "difficulty":"9.9829", - "description":[ - "", - "Loops are a critical part of any program! The next few challenges", - "first we will be taking a look at the for loop", - "", - "var ourArray = [];", - "for(var i = 0; i < 5; i++){", - " ourArray.push(i);", - "}", - "", - "ourArray now contains [0,1,2,3,4] ", - "Let's try getting a for loop to work by pushing values to an array" - ], - "tests":[ - "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" - ], - "challengeSeed":[ - "var myArray = [];", - "//Push the numbers 0-4 to myArray", - "", - "" - ], - "challengeType": 1 } ] } From 79938d0fc1d048c2bb900f6fdad7f5de9c7fb259 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Mon, 13 Jul 2015 21:55:36 +0100 Subject: [PATCH 06/13] Full JS Stuff There is a bit more RegEx and if else stuff. Other challenges can be added later but this is the base working set without @QuincyLarson 's fixes to the copy --- challenges/basic-javascript.json | 811 +++++++++++++++++++++++++------ 1 file changed, 665 insertions(+), 146 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 9a533cfe1c..993ce01944 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -2,18 +2,47 @@ "name": "Basic JavaScript", "order": 0.006, "challenges": [ + { + "_id":"bd7123c9c441eddfaeb4bdef", + "name":"Welcome To Comments", + "dashedName":"waypoint-welcome-to-comments", + "difficulty":"9.98", + "description":[ + "", + "A comment is a very useful line of code that is not actually ran by the machine executing it. With this property comments are the perfect way of creating notes to yourself or anyone else who reads your code describing what the code does", + "It's an extremely important part in writing good, efficient and maintainable code and a requirement by most employers", + "Let's take a look at the two ways in which we can write a comment in JavaScript", + " //This is a comment ", + "These comment out the entire line that they are on", + " /*This also is a comment*/ ", + "These comment out everything in between /* and */ ", + "Try creating one of each now." + ], + "tests":[ + "assert(editor.getValue().match(/(\\/\\*)...../g), 'Make sure you have at least one \/\\* \\*\/ style comment that has at least five letters in it');", + "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the coment with a \\*\/');", + "assert(editor.getValue().match(/(\\/\\/)...../g), 'Make sure that there is at least one \\/\\/ style comment with at least five letters in it');" + ], + "challengeSeed":[ + + ], + "challengeType": 1 + }, { "_id": "bd7123c9c441eddfaeb5bdef", - "name": "Meet Booleans", - "dashedNname": "waypoint-meet-booleans", - "difficulty": "9.98", + "name": "Unconditionally Loving Booleans", + "dashedName": "waypoint-unconditionally-loving-booleans", + "difficulty": "9.98001", "description": [ "Return true", - "Some additional directions" + "A boolean is a type of variable that represents either true or false (Named after the British mathematician George Boole).", + "Booleans are often the result of a function or a comparative operation, for example 1==1 is true whereas 1==2 is false.", + "They are most commonly found inside if statements which we shall cover later", + "For now Let's modify our welcomeToBooleans function so that it will return true instead of false when the run button is clicked" ], "tests": [ - "expect(welcomeToBooleans()).to.be.a(\"boolean\");", - "expect(welcomeToBooleans()).to.be.true;" + "assert(typeof(welcomeToBooleans())=='boolean', 'The value returned by welcomeToBooleans() should be a boolean value. (true of false)');", + "assert(welcomeToBooleans() == true, 'The value returned by welcomeToBooleans() should be true');" ], "challengeSeed": [ "function welcomeToBooleans() {", @@ -25,153 +54,74 @@ ], "challengeType": 1 }, - { - "_id": "bd7123c9c442eddfaeb5bdef", - "name": "Define Your Name", - "difficulty": "9.9801", - "description": [ - "Set the value of myName to your name by typing your name in quotes.", - "Currently myName is empty. Type in your name and hit the submit button.", - "Look at the ourName example if you get stuck." - ], - "tests": [ - "expect(myName).to.be.a(\"string\");", - "expect(myName).length.not.to.be(0);" - ], - "challengeSeed": [ - "// ourName = \"Free Code Camp\";", - "myName = \"\";" - ], - "challengeType": 1 - }, { "_id": "bd7123c9c443eddfaeb5bdef", "name": "Start Using Variables", - "difficulty": "9.9802", + "dashedName": "waypoint-start-using-variables", + "difficulty": "9.9801", "description": [ + "", "Now, use the var keyword to create a variable called myName. Set its value to your name.", "Variables are used to store values.", + "The name variable comes from the fact that it's value, varies!", + "Now Let's create our first variable called myName and because it's a name let's make it a string!", "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in camel case. An example of camel case is: camelCase.", "Look at the ourName example if you get stuck." ], "tests": [ - "expect(myName).to.be.a(\"string\");", - "expect(myName).length.not.to.be(0);" + "assert((function(){/**/if(typeof(myName) !== 'undefined' && typeof(myName) == 'string' && myName.length > 0){return(true);}else{return(false);}/**/})(), 'myName should be a string that contains at least one character in it');" ], "challengeSeed": [ "// var ourName = \"Free Code Camp\";", - "" + "", + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "", + "if(typeof(myName) !== 'undefined'){(function(v){return(v);})(myName);}" ], "challengeType": 1 }, { "_id": "bd7123c9c444eddfaeb5bdef", "name": "Define Your First and Last Name", - "difficulty": "9.9803", + "dashedName": "waypoint-define-your-first-and-last-name", + "difficulty": "9.9802", "description": [ - "Now, use the var keyword to create a variable called myFirstName and set its value to your first name. Then set a variable called myLastName to your last name.", - "Variables are used to store values.", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourFirstName and ourLastName examples if you get stuck." + "", + "Programs will almost always have several different variables that are used to keep track of several different pieces of data", + "We are now going to go and create two new variables myFirstName and myLastName that are strings", + "You can assign these variables to be equal to your first and last names respectively." ], "tests": [ - "expect(myFirstName).to.be.a(\"string\");", - "expect(myFirstName).length.not.to.be(0);", - "expect(myLastName).to.be.a(\"string\");", - "expect(myLastName).length.not.to.be(0);" + "assert((function(){if(typeof(myFirstName) !== 'undefined' && typeof(myFirstName) == 'string' && myFirstName.length > 0){return(true);}else{return(false);}})(), 'myFirstName should be a string with a least one character in it');", + "assert((function(){if(typeof(myLastName) !== 'undefined' && typeof(myLastName) == 'string' && myLastName.length > 0){return(true);}else{return(false);}})(), 'myLastName should be a string with a least one character in it');" ], "challengeSeed": [ + "// ourName = \"Free Code Camp\";", "// var ourFirstName = \"Free\";", "// var ourLastName = \"Code Camp\";", "", - "" - ], - "challengeType": 1 - }, - { - "_id": "bd7123c9c445eddfaeb5bdef", - "name": "Combine Two Strings into One String", - "difficulty": "9.9804", - "description": [ - "Make a variable called myName by adding the string of your first name to the string of your last name.", - "Strings can be combined in a process called concatenation.", - "Be sure to include a space at the end of your first string. Otherwise the two strings will not have a space between them.", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourName example if you get stuck." - ], - "tests": [ - "expect(myName).to.be.a(\"string\");", - "expect(myName).length.not.to.be(0);", - "expect((/\\s+/).test(myName)).to.be.true;" - ], - "challengeSeed": [ - "// var ourName = \"Free \" + \"Code Camp\";", "", - "" - ], - "challengeType": 1 - }, - { - "_id": "bd7123c9c446eddfaeb5bdef", - "name": "Combine Two Variables into One Variable", - "difficulty": "9.9805", - "description": [ - "Make the variables myFirstName, myLastName, and myFullName. Concatenate my myFirstName to myLastName to create myFullName.", - "Strings can be combined in a process called concatenation.", - "Be sure to include a space at the end of myFirstName. Otherwise myFullName will not contain a space between your first and last names.", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourFullName example if you get stuck." - ], - "tests": [ - "expect(myFirstName).to.be.a(\"string\");", - "expect(myLastName).to.be.a(\"string\");", - "expect(myFullName).to.be.a(\"string\");", - "expect(myFullName).length.not.to.be(0);", - "expect((/\\s+/).test(myFullName)).to.be.true;" - ], - "challengeSeed": [ - "// var ourFirstName = \"Free \";", - "// var ourLastName = \"Code Camp\";", - "// var ourFullName = ourFirstName + ourLastName;", - "" - ], - "challengeType": 1 - }, - { - "_id": "bd7123c9c447eddfaeb5bdef", - "name": "Concatenate Both Variables and Strings into the Same Variable", - "difficulty": "9.9806", - "description": [ - "Make the variables myFirstName, myLastName, and myFullName. Concatenate my myFirstName to myLastName to create myFullName, but this time add the space as a separate string, not as part of myFirstName or myLastName.", - "Strings can be combined in a process called concatenation.", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourFullName example if you get stuck." - ], - "tests": [ - "expect(myFirstName).to.be.a(\"string\");", - "expect(myLastName).to.be.a(\"string\");", - "expect(myFullName).to.be.a(\"string\");", - "expect(myFullName).length.not.to.be(0);", - "expect((/\\s+/).test(myFullName)).to.be.true;" - ], - "challengeSeed": [ - "// var ourFirstName = \"Free\";", - "// var ourLastName = \"Code Camp\";", - "// var ourFullName = ourFirstName + \" \" + ourLastName;", - "" + "// You can ignore this.", + "// We use this to show you the value of your variable in your output box.", + "// We'll learn about functions soon.", + "if(typeof(myFirstName) !== 'undefined' && typeof(myLastName) !== 'undefined'){(function(y,z){return(y + ', ' + z);})(myFirstName, myLastName);}" ], "challengeType": 1 }, { "_id": "bd7123c9c448eddfaeb5bdef", "name": "Check the Length Property of a String Variable", + "dashedName": "waypoint-check-the-length-property-of-a-string-variable", "difficulty": "9.9809", "description": [ + "", "Use the .length property to count the number of characters in the lastNameLength variable.", "For example, if we created a variable var firstName = \"Julie\", we could find out how long the string \"Julie\" is by using the firstName.length property." ], "tests": [ - "expect(lastNameLength).to.equal(4);" + "(function(){if(typeof(lastNameLength) != 'undefined' && typeof(lastNameLength) == 'number' && lastNameLength == 4){return(true);}else}{return(false);}}, 'lastNameLength should be equal to four')()" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -187,16 +137,14 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "function returnValue(lastNameLength) {", - " return lastNameLength;", - "}", - "returnValue(lastNameLength);" + "if(typeof(lastNameLength) != 'undefined')(function(v){return(v);})(lastNameLength);}" ], "challengeType": 1 }, { "_id": "bd7123c9c549eddfaeb5bdef", "name": "Use Bracket Notation to Find the First Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-first-character-in-a-string", "difficulty": "9.9810", "description": [ "Use bracket notation to find the first character in a the firstLetterOfLastName variable.", @@ -206,7 +154,7 @@ "Try looking at the firstLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "expect(firstLetterOfLastName).to.equal('C');" + "assert((function(){if(typeof(firstLetterOfLastName) != 'undefined' && typeof(firstLetterOfLastName) == 'string' && firstLetterOfLastName == 'C'){return(true);}else{return(false);}})(), 'The first letter of firstLetterOfLastName should be a C');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -221,26 +169,23 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "function returnValue(firstLetterOfLastName) {", - " return firstLetterOfLastName;", - "}", - "returnValue(firstLetterOfLastName);" + "(function(v){return(v);})(firstLetterOfLastName);" ], "challengeType": 1 }, { "_id": "bd7123c9c450eddfaeb5bdef", "name": "Use Bracket Notation to Find the Nth Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-nth-character-in-a-string", "difficulty": "9.9811", "description": [ - "Use bracket notation to find the 3rd character in the lastName variable.", - "Bracket notation is a way to get a character at a specific index within a string.", - "Computers don't start counting at 1 like humans do. They start at 0.", - "For example, the character at index 0 in the word \"Julie\" is \"J\". So if var firstName = \"Julie\", you can get the value of the first letter of the string by using firstName[0].", + "Just like the last lesson where we used Bracket Notation to access the first letter we can use the same method to get the letters ar other positions", + "Don't forget that computers start counting at 0 so the first letter is actually the zeroth one", + "Let's now try to set thirdLetterOfLastName to equal the third letter of the lastName variable", "Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "expect(thirdLetterOfLastName).to.equal('e');" + "assert(thirdLetterOfLastName == 'e', 'The third last letter of lastName should be an e');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -255,16 +200,14 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "function returnValue(thirdLetterOfLastName) {", - " return thirdLetterOfLastName;", - "}", - "returnValue(thirdLetterOfLastName);" + "(function(v){return(v);})(thirdLetterOfLastName);" ], "challengeType": 1 }, { "_id": "bd7123c9c451eddfaeb5bdef", "name": "Use Bracket Notation to Find the Last Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-last-character-in-a-string", "difficulty": "9.9812", "description": [ "Use bracket notation to find the last character in the lastName variable.", @@ -274,7 +217,8 @@ "Try looking at the lastLetterOfLastName variable declaration if you get stuck." ], "tests": [ - "expect(lastLetterOfLastName).to.equal('n');" + "assert(lastLetterOfLastName == 'n', 'lastLetterOfLastName should be n');", + "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the last letter');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -286,19 +230,14 @@ "var lastLetterOfLastName = lastName;", "", "", - "// You can ignore this.", - "// We use this to show you the value of your variable in your output box.", - "// We'll learn about functions soon.", - "function returnValue(lastLetterOfLastName) {", - " return lastLetterOfLastName;", - "}", - "returnValue(lastLetterOfLastName);" + "(function(v){return(v);})(lastLetterOfLastName);" ], "challengeType": 1 }, { "_id": "bd7123c9c452eddfaeb5bdef", "name": "Use Bracket Notation to Find the Nth to Last Character in a String", + "dashedName": "waypoint-use-bracket-notation-to-find-the-nth-to-last-character-in-a-string", "difficulty": "9.9813", "description": [ "Use bracket notation to find the second-to-last character in the lastName variable.", @@ -308,7 +247,8 @@ "Try looking at the lastLetterOfLastName variable declaration if you get stuck." ], "tests": [ - "expect(secondToLastLetterOfLastName).to.equal('e');" + "assert(secondToLastLetterOfLastName == 'e', 'secondToLastLetterOfLastName should be e');", + "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the third last letter');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -320,13 +260,592 @@ "var secondToLastLetterOfLastName = lastName;", "", "", - "// You can ignore this.", - "// We use this to show you the value of your variable in your output box.", - "// We'll learn about functions soon.", - "function returnValue(secondToLastLetterOfLastName) {", - " return secondToLastLetterOfLastName;", + "(function(v){return(v);})(secondToLastLetterOfLastName);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb3bdef", + "name": "Magical Maths Addition", + "dashedName": "waypoint-magical-maths-addition", + "difficulty": "9.98141", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use + for addition", + "Replace the 0 with correct number to achieve the result in the comment." + ], + "tests": [ + "assert((function(){if(add == 20 && editor.getValue().match(/\\+/g)){return(true);}else{return(false);}})(), 'Add should be the result of a sum and be equal to 20');" + ], + "challengeSeed": [ + "var add = 10 + 0;//equals 20", + "", + "", + "", + "(function(z){return('add='+z);})(add);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb4bdef", + "name": "Magical Maths Subtraction", + "dashedName": "waypoint-magical-maths-subtraction", + "difficulty": "9.98142", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use - for subtraction", + "Replace the 0 with correct number to achieve the result in the comment." + ], + "tests": [ + "assert((function(){if(subtract == 12 && editor.getValue().match(/\\-/g)){return(true);}else{return(false);}})(), 'Subtract should be the result of a sum and be equal to 12');" + ], + "challengeSeed": [ + "var subtract = 45 - 0;//equals 12", + "", + "", + "", + "(function(z){return('subtract='+z);})(subtract);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb5bdef", + "name": "Magical Maths Multiplication", + "dashedName": "waypoint-magical-maths-multiplication", + "difficulty": "9.98143", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use * for multiplication", + "Replace the 0 with correct number to achieve the result in the comment." + ], + "tests": [ + "assert((function(){if(multiply == 80 && editor.getValue().match(/\\*/g)){return(true);}else{return(false);}})(), 'Multiply should be the result of a sum and be equal to 80');" + ], + "challengeSeed": [ + "var multiply = 8 * 0;//equals 80", + "", + "", + "", + "(function(z){return('multiply='+z);})(multiply);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb6bdef", + "name": "Magical Maths Division", + "dashedName": "waypoint-magical-maths-division", + "difficulty": "9.9814", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use / for division", + "Replace the 0 with correct number to achieve the result in the comment." + ], + "tests": [ + "assert((function(){if(divide == 2 && editor.getValue().match(/\\//g)){return(true);}else{return(false);}})(), 'Divide should be the result of a sum and be equal to 2');" + ], + "challengeSeed": [ + "var divide = 66 / 0;//equals 2", + "", + "", + "", + "(function(z){return('divide='+z);})(divide);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb4bdef", + "name": "Creating Decimals", + "dashedName": "waypoint-creating-decimals", + "difficulty": "9.9815", + "description": [ + "", + "in JavaScript we can can work with decimal numbers", + "These decal numbers are known as floats.", + "Let's create a float now called myFloat and give it a value" + ], + "tests": [ + "assert((function(){if(typeof(myFloat) != 'undefined' && typeof(myFloat) == 'number' && editor.getValue().match(/\\./g).length >=2){return(true);}else{return(false);}})(), 'myFloat should be a decimal point number');" + ], + "challengeSeed": [ + "//var ourFloat = 5.7", + "//Create a number with a decimal point here called myFloat", + "", + "", + "", + "", + "if(typeof(myFloat) != 'undefined'){(function(z){return(z);})(myFloat);}" + ], + "challengeType": 1 + }, + { + "_id": "bd7993c9c69feddfaeb7bdef", + "name": "Working With Decimals", + "dashedName": "waypoint-working-with-decimals", + "difficulty": "9.98151", + "description": [ + "", + "in JavaScript we can can work with decimal numbers", + "These decal numbers are known as floats.", + "Let's take a look at working with floats now" + ], + "tests": [ + "assert(multiply == 15, 'The result of multiply should be 3.75');", + "assert(divide == 2.25, 'The result of divide should be 2.25');" + ], + "challengeSeed": [ + "var multiply = 3.75 * 0;//equals 15", + "var divide = 9 / 0;//equals 2.25", + "", + "", + "", + "(function(y,z){return('multiply='+y+', divide='+z);})(multiply,divide);" + ], + "challengeType": 1 + }, + { + "_id": "bd7993c9c69feddfaeb8bdef", + "name": "An Array Of new Information", + "dashedName": "waypoint-an-array-of-new-information", + "difficulty": "9.9816", + "description": [ + "", + "In JavaScript we can store lists or collections of data in what are called arrays", + "Arrays are distinguished by the [ and ] around the data. Each piece of data is separated be a , ", + "Now let's create a new array called myArray with a string and a number with a , separating each one", + "Refer to the example if you get stuck", + "" + ], + "tests": [ + "assert(typeof(myArray) == 'object', 'myArray should be an array');", + "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The fist item in myArray should be a string');", + "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number');" + ], + "challengeSeed": [ + "//var array = ['John', 23];", + "", + "var myArray = [];", + "", + "", + "(function(z){return(z);})(myArray);" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb7bdef", + "name":"Nesting Arrays", + "dashedName":"waypoint-nesting-arrays", + "difficulty":"9.98161", + "description":[ + "", + "We are also able to create arrays within arrays. This technique is called nesting.", + "Let's now go create a nested array called myArray" + ], + "tests":[ + "assert((function(){if(typeof(myArray) !== 'undefined' && typeof(myArray) === 'object' && typeof(myArray[0]) !== 'undefined' && typeof(myArray) === 'object'){return(true);}else{return(false);}})(), 'myArray should contain at least one array');" + ], + "challengeSeed":[ + "var myArray = [];", + "", + "", + "if(typeof(myArray) !== 'undefined'){(function(){return(myArray);})();}" + ], + "challengeType": 1 + }, + { + "_id":"bg9997c9c79feddfaeb9bdef", + "name":"Accessing data with Indexes", + "dashedName":"waypoint-accessing-data-with-indexes", + "difficulty":"9.9817", + "description":[ + "", + "Once an array has been created we can access the data we have stored in them using indexes", + "Indexes are written in the same way as bracket notation that we covered earlier", + "Example:", + "", + "var array = [1,2,3];", + "array[0];//equals 1", + "var data = array[1];", + "", + "Create a var called data and set it to equal the first value of myArray" + ], + "tests":[ + "assert((function(){if(typeof(myArray) != 'undefined' && typeof(data) != 'undefined' && myArray[0] == data){return(true);}else{return(false);}})(), 'the variable data should equal the first value of myArray');" + ], + "challengeSeed":[ + "//var ourArray = [1,2,3]", + "//var ourData = ourArray[0]//equals 1", + "", + "var myArray = [1,2,3];", + "", + "", + "", + "if(typeof(myArray) != 'undefined' && typeof(data) != 'undefined'){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', data = ' + JSON.stringify(z));})(myArray, data);}" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb8bdef", + "name":"Modifying Data With Indexes", + "dashedName":"waypoint-modifying-data-with-indexes", + "difficulty":"9.98171", + "description":[ + "", + "We are able to modify the data store in an array be using indexes", + "Example:", + "", + "var ourArray = [1,2,3];", + "ourArray[0] = 3;//ourArray equals [3,2,3]", + "", + "Now Let's modify myArray using an index", + "" + ], + "tests":[ + "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return(true);}else{return(false);}})(), 'myArray should now be [3,2,3]');", + "assert((function(){if(editor.getValue().match(/[0]/g).length >= 2 && editor.getValue().match(/=/g).length >= 2){return(true);}else{return(false);}})(), 'You should be using indexes to modify the values in myArray');" + ], + "challengeSeed":[ + "//var ourArray = [1,2,3];", + "//ourArray[0] = 3;", + "", + "var myArray = [1,2,3];", + "", + "", + "", + "", + "if(typeof(myArray) != 'undefined'){(function(){return(myArray);})();}" + ], + "challengeType": 1 + }, + { + "_id": "bg9994c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With pop()", + "dashedName": "waypoint-manipulating-arrays-with-pop", + "difficulty": "9.9818", + "description": [ + "", + "When and array has been defined we still have the ability to make changes to it afterwards", + "One common way in which we can manipulate the data in an array is through .pop() ", + " .pop() is used to \"pop\" a value from the end of an array. We can retrieve this value by preforming the pop in a variable declaration.", + "any type of variable can be \"popped\" from and array", + "Let's try .pop() now" + ], + "tests": [ + "assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');", + "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return(true);}else{return(false);}})(removed), 'myArray should only have the first two values left([\"cat\"], 2)');" + ], + "challengeSeed": [ + "//var numbers = [1,2,3];", + "//console.log(numbers); //Gives [1,2,3]", + "//var removed = numbers.pop();", + "//console.log(numbers); //Gives [1,2]", + "//console.log(removed); //Gives 3", + "", + "var myArray = ['John', 23, ['cat', 2]];", + "var removed = _;//This should be ['cat', 2] and myArray should now be ['John', 23]", + "", + "", + "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);" + ], + "challengeType": 1 + }, + { + "_id": "bg9995c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With push()", + "dashedName": "waypoint-manipulating-arrays-with-push", + "difficulty": "9.9818", + "description": [ + "", + "Now that we've learn how to pop things from the end of the array, we need to learn how to push stuff back to the end", + "Let's take the code we had last time and push this value to the end: ['dog', 3] " + ], + "tests": [ + "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]])');" + ], + "challengeSeed": [ + "var myArray = ['John', 23, ['cat', 2]];", + "var removed = myArray.pop();", + "//Add a ['dog', 3] to the end of myArray using push", + "", + "", + "(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);" + ], + "challengeType": 1 + }, + { + "_id": "bg9996c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With shift()", + "dashedName": "waypoint-manipulating-arrays-with-shift", + "difficulty": "9.9817", + "description": [ + "", + "Another common way in which we can manipulate the data in an array is through .shift() ", + " .shift() is used to \"shift\" a value from the start of an array. We can retrieve this value by preforming the shift in a variable declaration.", + "Let's try .shift() now" + ], + "tests": [ + "assert((function(d){if(d[0] == 23 && d[1][0] == 'dog' && d[1][1] == 3 && d[2] == undefined){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23])');", + "assert((function(d){if(d == 'John'){return(true);}else{return(false);}})(removed), 'Removed should contain \"John\"');" + ], + "challengeSeed": [ + "var myArray = ['John', 23, ['dog', 3]];", + "var removed = _;//This should be ['John'] and myArray should now be ['John', 23]", + "", + "", + "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);" + ], + "challengeType": 1 + }, + { + "_id": "bg9997c9c69feddfaeb9bdef", + "name": "Manipulating Arrays With unshift()", + "dashedName": "waypoint-manipulating-arrays-with-unshift", + "difficulty": "9.9818", + "description": [ + "", + "Now that we've learned how to shift things from the start of the array, we need to learn how to unshift stuff back to the start", + "Let's take the code we had last time and unshift this value to the end: 'Paul' " + ], + "tests": [ + "assert((function(d){if(d[0].toLowerCase() == 'paul' && d[1] == 23 && d[2][0] != undefined && d[2][0] == 'dog' && d[2][1] != undefined && d[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should now have [\"Paul\", 23, [\"dog\", 3]])');" + ], + "challengeSeed": [ + "var myArray = ['John', 23, ['dog', 3]];", + "var removed = myArray.shift();//This should be 'John' and myArray should now be [23, ['dog', 3]]", + "//Add 'Paul' to the start of myArray", + "", + "", + "(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);" + ], + "challengeType": 1 + }, + { + "_id":"bg9997c9c89feddfaeb9bdef", + "name":"Make it functional", + "dashedName":"waypoint-make-it-functional", + "difficulty":"9.9819", + "description":[ + "", + "In JavaScript we can divide up our code into separate and reusable parts called functions", + "here's and example of a function", + "", + "function functionName (a, b){", + " return(a + b);", + "}", + "", + "our function can be called like this", + "functionName();", + "Let's try creating and calling a function now called myFunction" + ], + "tests":[ + "assert((function(){if(typeof(f) !== 'undefined' && typeof(f) === 'number' && f === 9){return(true);}else{return(false);}})(), 'Your function should return the value of a + b');" + ], + "challengeSeed":[ + "var a = 4;", + "var b = 5;", + "//Don not modify the above!", + "//Create a function called myFunction that adds a and b", + "", + "", + "", + "", + "//Don't modify this!", + "if(typeof(myFunction) != 'undefined'){", + "var f=myFunction(a,b);", + "(function(){return(f);})();", + "}" + ], + "challengeType": 1 + }, + { + "_id":"bg9998c9c99feddfaeb9bdef", + "name":"I Object!", + "dashedName":"waypoint-i-object", + "difficulty":"9.9822", + "description":[ + "", + "A very important data type in javascript is the Object ", + " Objects a similar to arrays except that instead of using indexes to access and modify their data, Objects have what are called properties ", + "Here's a sample Object", + "", + "var cat = {", + " \"name\": \"Whiskers\",", + " \"legs\": 4,", + " \"tails\": 1,", + " \"enemies\": [\"Water\", \"Dogs\"]", + "};", + "", + "Objects are useful for storing data in a structured way or in a way that represents a real world object like a cat.", + "Let's try to make a Object that represents a dog called myDog!" + + ], + "tests":[ + "assert((function(z){if(z.hasOwnProperty('name') && z.name != undefined && typeof(z.name) == 'string'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property name and it should be a string');", + "assert((function(z){if(z.hasOwnProperty('legs') && z.legs != undefined && typeof(z.legs) == 'number'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property legs and it should be a number');", + "assert((function(z){if(z.hasOwnProperty('tails') && z.tails != undefined && typeof(z.tails) == 'number'){return(true);}else{return(false);}})(myDog), 'myDog should contain the property tails and it should be a number');", + "assert((function(z){if(z.hasOwnProperty('friends') && z.friends != undefined && Array.isArray(z.friends)){return(true);}else{return(false);}})(myDog), 'myDog should contain the property friends and it should be an array');" + ], + "challengeSeed":[ + "//var ourDog = {", + "// \"name\": \"Camper\"", + "// \"legs\": 4", + "// \"tails\": 1", + "// \"friends\": ['everything!']", + "//};", + "", + "/* add the name(string), legs(number), tails(number) and friends(array) properties to myDog.", + "You can set them to whatever you want!*/", + "", + "var myDog = {", + " ", + "};", + "", + "(function(z){return(z);})(myDog);" + ], + "challengeType": 1 + }, + { + "_id":"bg9999c9c99feddfaeb9bdef", + "name":"Manipulating Objects", + "dashedName":"waypoint-manipulating-objects", + "difficulty":"9.9823", + "description":[ + "", + "Now that we have an objects we need to know how to add and remove properties from it", + "We add properties to objects like this", + "myObject['myProperty'] = \"myValue\";", + "They can also be deleted like this", + "delete(myObject[\"myProperty\"]);", + "Let's add the property bark", + "" + ], + "tests":[ + "assert(myDog.bark != undefined, 'The property tails should have been deleted');", + "assert(myDog.tails == undefined, 'The property tails should have been deleted');" + ], + "challengeSeed":[ + "//var ourDog = {", + "//\"name\": \"Camper\"", + "//\"legs\": 4", + "//\"tails\": 1", + "//\"friends\": [\"everything!\"]", + "//};", + "", + "//Re-create myDog", + "", + "var myDog = {", + " \"name\": _,", + " \"legs\": _,", + " \"tails\": _,", + " \"friends\": []", + "};", + "", + "//Let's add the property age to myDog", + "", + "", + "//Now delete the property tails", + "", + "", + "(function(z){return(z);})(myDog);" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb5bdef", + "name":"Looping with for", + "dashedName":"waypoint-looping-with-for", + "difficulty":"9.9824", + "description":[ + "", + "Loops are a critical part of any program! The next few challenges", + "first we will be taking a look at the for loop", + "", + "var ourArray = [];", + "for(var i = 0; i < 5; i++){", + " ourArray.push(i);", "}", - "returnValue(secondToLastLetterOfLastName);" + "", + "ourArray now contains [0,1,2,3,4] ", + "Let's try getting a for loop to work by pushing values to an array" + ], + "tests":[ + "assert(editor.getValue().match(/for\\(/g), 'You should be using a for loop for this!');", + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb1bdef", + "name":"Looping with while", + "dashedName":"waypoint-looping-with-while", + "difficulty":"9.9825", + "description":[ + "", + "Loops are a critical part of any program! The next few challenges", + "first we will be taking a look at the for loop", + "", + "var ourArray = [];", + "var i = 0;", + "while(i < 5){", + " ourArray.push(i);", + " i++;", + "}", + "", + "Let's try getting a for loop to work by pushing values to an array" + ], + "tests":[ + "assert(editor.getValue().match(/while\\(/g), 'You should be using a while loop for this!');", + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb2bdef", + "name":"Looping with do while", + "dashedName":"waypoint-looping-with-do-while", + "difficulty":"9.9826", + "description":[ + "", + "Let's now take a look at the do - while loop", + "", + "var ourArray = [];", + "var i = 0;", + "do{", + " ourArray.push(i);", + " i++;", + "}while(i<5);", + "", + "A do - while has a very special difference when compared to the for and while loops. The do while loop is guaranteed to execute preform it's action once regardless of whether or not the condition inside the while is met!", + "Let's try getting a do - while loop to work by pushing values to an array" + ], + "tests":[ + "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');", + "assert((function(){if(editor.getValue().match(/do/g) && editor.getValue(/while/g).match()){return(true);}else{return(false);}})(), 'You should be using a do while loop for this!');" + ], + "challengeSeed":[ + "var myArray = [];", + "//Push the numbers 0-4 to myArray", + "", + "" ], "challengeType": 1 } From a2bae52c659c383036583f286a26bb9cdb1cd51e Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Thu, 16 Jul 2015 11:06:04 +0100 Subject: [PATCH 07/13] Added start of the random number challenges --- challenges/basic-javascript.json | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 993ce01944..7bf51368b5 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -848,6 +848,68 @@ "" ], "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb9bdef", + "name":"Random Numbers", + "dashedName":"waypoint-random-numbers", + "difficulty":"9.9827", + "description":[ + "", + "Random numbers are a very useful for creating random behaviours and games", + "Javascript has a Math.random() method that can generate a random decimal number", + "Let's have a go of Math.random() now be getting myFunction to return a random number" + ], + "tests":[ + "assert(typeof(myFunction()) === 'number', 'myFunction should return a random number');", + "assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction should be a decimal');", + "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random to generate the random decimal number');" + ], + "challengeSeed":[ + "", + "function myFunction(){", + " //Change the 0 to Math.random()", + " return(0);", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb1bdef", + "name":"Random Whole Numbers", + "dashedName":"waypoint-random-whole-numbers", + "difficulty":"9.9828", + "description":[ + "", + "While it's great that we can create random decimal numbers it's a lot more useful to generate a random whole number", + "To achieve this we can multiply the random number by ten and use the Math.floor() to convert the decimal number to a whole number", + "This technique gives us a whole number between zero and nine", + "Let's give this technique a go now" + ], + "tests":[], + "challengeSeed":[ + "function myFunction(){", + " //Make myFunction return a random number between zero and nine instead of a float", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"", + "name":"Random Whole Numbers In a Range", + "dashedName":"waypoint-random-whole-numbers-in-a-range", + "difficulty":"9.9829", + "description":[ + "", + "" + ], + "tests":[], + "challengeSeed":[], + "challengeType": 1 } ] } From 5227fc0214b1d8d66d0bf275109444ac951ed52e Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 24 Jul 2015 00:35:50 +0100 Subject: [PATCH 08/13] Ready JavaScript Curriculum --- challenges/basic-javascript.json | 713 +++++++++++++++++++------------ 1 file changed, 437 insertions(+), 276 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 9a50f07b5c..9fb5129929 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -19,9 +19,9 @@ "Try creating one of each now." ], "tests":[ - "assert(editor.getValue().match(/(\\/\\*)...../g), 'Make sure you have at least one \/\\* \\*\/ style comment that has at least three letters in it');", + "assert(editor.getValue().match(/(\\/\\*)...../g), 'Make sure you have at least one \/\\* \\*\/ style comment that has at least five letters in it');", "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the coment with a \\*\/');", - "assert(editor.getValue().match(/(\\/\\/)...../g), 'Make sure that there is at least one \\/\\/ style comment with at least three letters in it');" + "assert(editor.getValue().match(/(\\/\\/)...../g), 'Make sure that there is at least one \\/\\/ style comment with at least five letters in it');" ], "challengeSeed":[ @@ -69,8 +69,7 @@ "Look at the ourName example if you get stuck." ], "tests": [ - "assert(typeof(myName) == 'string', \"You're new variable should be a string\");", - "assert(myName.length > 0, \"You're string should have something in it!\");" + "assert((function(){/**/if(typeof(myName) !== 'undefined' && typeof(myName) == 'string' && myName.length > 0){return(true);}else{return(false);}/**/})(), 'myName should be a string that contains at least one character in it');" ], "challengeSeed": [ "// var ourName = \"Free Code Camp\";", @@ -78,34 +77,8 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "(function(v){return(v);})(ourName);" - ], - "challengeType": 1 - }, - { - "_id": "bd7123c9c442eddfaeb5bdef", - "name": "Define Your Name", - "dashedName": "waypoint-define-your-name", - "difficulty": "9.9802", - "description": [ "", - "In this challenge we are going to take a look at strings.", - "Strings are a data type for words and sentences", - "Now we are going to set the value of myName to your name by typing your name in quotes.", - "Currently myName is empty. Type in your name and hit the submit button.", - "Look at the ourName example if you get stuck." - ], - "tests": [ - "assert(typeof(myName) == 'string', 'The variable myName should be a string');", - "assert(myName.length > 0, 'Give the string myName a value');" - ], - "challengeSeed": [ - "// ourName = \"Free Code Camp\";", - "myName = \"\";", - "// You can ignore this.", - "// We use this to show you the value of your variable in your output box.", - "// We'll learn about functions soon.", - "(function(v){return(v);})(myName);" + "if(typeof(myName) !== 'undefined'){(function(v){return(v);})(myName);}" ], "challengeType": 1 }, @@ -113,7 +86,7 @@ "_id": "bd7123c9c444eddfaeb5bdef", "name": "Define Your First and Last Name", "dashedName": "waypoint-define-your-first-and-last-name", - "difficulty": "9.9804", + "difficulty": "9.9802", "description": [ "", "Programs will almost always have several different variables that are used to keep track of several different pieces of data", @@ -121,64 +94,19 @@ "You can assign these variables to be equal to your first and last names respectively." ], "tests": [ - "assert(typeof(myFirstName) == 'string', 'myFirstName should be set to a string');", - "assert(typeof(myLastName) == 'string', 'myLastName should be set to a string');", - "assert(myFirstName.length > 0, 'myFirstName Should not be empty');", - "assert(myLastName.length > 0, 'myLastName should not be empty');", - "assert(typeof(myName) == 'string', 'The variable myName should be a string');", - "assert(myName.length > 0, 'Give the string myName a value');" + "assert((function(){if(typeof(myFirstName) !== 'undefined' && typeof(myFirstName) == 'string' && myFirstName.length > 0){return(true);}else{return(false);}})(), 'myFirstName should be a string with a least one character in it');", + "assert((function(){if(typeof(myLastName) !== 'undefined' && typeof(myLastName) == 'string' && myLastName.length > 0){return(true);}else{return(false);}})(), 'myLastName should be a string with a least one character in it');" ], "challengeSeed": [ "// ourName = \"Free Code Camp\";", "// var ourFirstName = \"Free\";", "// var ourLastName = \"Code Camp\";", "", - "var myName = \"\";", - "", "", "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "(function(v){return(v);})(myName);" - ], - "challengeType": 1 - }, - { - "_id": "bd7123c9c445eddfaeb5bdef", - "name": "Combine Two Strings into One String", - "dashedName": "waypoint-combine-two-variables-into-one-string", - "difficulty": "9.9805", - "description": [ - "Make a variable called myName by adding the string of your first name to the string of your last name.", - "Strings can be combined in a process called concatenation.", - "We are now going to take the two variables myFirstName and myLastName and assign them values", - "Once we have given values to our two variables we can now concatenate them together with a space in between them", - "Be sure to use lowercase and uppercase letters properly. JavaScript variables are written in lower camel case. An example of lower camel case is: lowerCamelCase.", - "Look at the ourName example if you get stuck." - ], - "tests": [ - "assert(typeof(myFirstName) == 'string', 'myFirstName should be set to a string');", - "assert(typeof(myLastName) == 'string', 'myLastName should be set to a string');", - "assert(myFirstName.length > 0, 'myFirstName Should not be empty');", - "assert(myLastName.length > 0, 'myLastName should not be empty');", - "assert(typeof(myName) == 'string', 'myName should be a string');", - "assert(myName.length > 0, \"You're string should have something in it!\");", - "assert((/\\s+/).test(myName) == true, 'myName shuold contain a space');" - ], - "challengeSeed": [ - "// var ourFirstName = \"Free\";", - "// var ourLastName = \"Code Camp\";", - "// var ourName = ourFirstName + \" \" + ourLastName;", - "", - "var myFirstName = \"\";", - "var myLastName = \"\";", - "var myName;", - "", - "", - "// You can ignore this.", - "// We use this to show you the value of your variable in your output box.", - "// We'll learn about functions soon.", - "(function(v){return(v);})(myName);" + "if(typeof(myFirstName) !== 'undefined' && typeof(myLastName) !== 'undefined'){(function(y,z){return(y + ', ' + z);})(myFirstName, myLastName);}" ], "challengeType": 1 }, @@ -193,7 +121,7 @@ "For example, if we created a variable var firstName = \"Julie\", we could find out how long the string \"Julie\" is by using the firstName.length property." ], "tests": [ - "assert(lastNameLength == 4, 'lastNameLength should have a length of 4');" + "(function(){if(typeof(lastNameLength) != 'undefined' && typeof(lastNameLength) == 'number' && lastNameLength == 4){return(true);}else}{return(false);}}, 'lastNameLength should be equal to four')()" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -209,7 +137,7 @@ "// You can ignore this.", "// We use this to show you the value of your variable in your output box.", "// We'll learn about functions soon.", - "(function(v){return(v);})(lastNameLength);" + "if(typeof(lastNameLength) != 'undefined')(function(v){return(v);})(lastNameLength);}" ], "challengeType": 1 }, @@ -226,7 +154,7 @@ "Try looking at the firstLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "assert(firstLetterOfLastName == 'C', 'The first letter of firstLetterOfLastName should be a C');" + "assert((function(){if(typeof(firstLetterOfLastName) != 'undefined' && typeof(firstLetterOfLastName) == 'string' && firstLetterOfLastName == 'C'){return(true);}else{return(false);}})(), 'The first letter of firstLetterOfLastName should be a C');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -253,11 +181,11 @@ "description": [ "Just like the last lesson where we used Bracket Notation to access the first letter we can use the same method to get the letters ar other positions", "Don't forget that computers start counting at 0 so the first letter is actually the zeroth one", - "Let's now try to set thirdLetterOfLastName to equal the third letter of the lastName variable", + "Let's now try to set thirdLetterOfLastName to equal the third letter of the lastName variable", "Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ - "assert(thirdLetterOfLastName == 'e', thirdLetterOfLastName);" + "assert(thirdLetterOfLastName == 'e', 'The third last letter of lastName should be an e');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -289,7 +217,8 @@ "Try looking at the lastLetterOfLastName variable declaration if you get stuck." ], "tests": [ - "assert(lastLetterOfLastName == 'n', 'lastLetterOfLastName should be n');" + "assert(lastLetterOfLastName == 'n', 'lastLetterOfLastName should be n');", + "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the last letter');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -318,7 +247,8 @@ "Try looking at the lastLetterOfLastName variable declaration if you get stuck." ], "tests": [ - "assert(secondToLastLetterOfLastName == 'e', 'secondToLastLetterOfLastName should be e');" + "assert(secondToLastLetterOfLastName == 'e', 'secondToLastLetterOfLastName should be e');", + "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the third last letter');" ], "challengeSeed": [ "var firstName = \"Madeline\";", @@ -335,35 +265,123 @@ "challengeType": 1 }, { - "_id": "bd7993c9c69feddfaeb6bdef", - "name": "Magical Maths", - "dashedName": "waypoint-magical-maths", - "difficulty": "9.9814", + "_id": "bh1111c1c11feddfaeb3bdef", + "name": "Magical Maths Addition", + "dashedName": "waypoint-magical-maths-addition", + "difficulty": "9.98141", "description": [ "", "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", "Let's try a few of the most commonly used ones now", "We use + for addition", - "We use - for subtraction", - "We use * for multiplication", - "We use / for division", - "Replace the _ with correct number to achieve the result in the comment." + "Replace the 0 with correct number to achieve the result in the comment." ], "tests": [ - "assert(add==20, 'The result of the sum in add should be 20');", - "assert(subtract==12, 'The result of the sum in add should be 12');", - "assert(multiply==80, 'The result of the sum in add should be 80');", - "assert(divide==2, 'The result of the sum in add should be 2');" + "assert((function(){if(add == 20 && editor.getValue().match(/\\+/g)){return(true);}else{return(false);}})(), 'Add should be the result of a sum and be equal to 20');" ], "challengeSeed": [ - "var add = 10 + _;//equals 20", - "var subtract = 45 - _;//equals 12", - "var multiply = 8 * _;//equals 80", - "var divide = 66 / _;//equals 2", + "var add = 10 + 0;//equals 20", "", "", "", - "(function(w,x,y,z){return('add='+w+', subtract='+x+', multiply='+y+', divide='+z);})(add,subtract,multiply,divide);" + "(function(z){return('add='+z);})(add);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb4bdef", + "name": "Magical Maths Subtraction", + "dashedName": "waypoint-magical-maths-subtraction", + "difficulty": "9.98142", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use - for subtraction", + "Replace the 0 with correct number to achieve the result in the comment." + ], + "tests": [ + "assert((function(){if(subtract == 12 && editor.getValue().match(/\\-/g)){return(true);}else{return(false);}})(), 'Subtract should be the result of a sum and be equal to 12');" + ], + "challengeSeed": [ + "var subtract = 45 - 0;//equals 12", + "", + "", + "", + "(function(z){return('subtract='+z);})(subtract);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb5bdef", + "name": "Magical Maths Multiplication", + "dashedName": "waypoint-magical-maths-multiplication", + "difficulty": "9.98143", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use * for multiplication", + "Replace the 0 with correct number to achieve the result in the comment." + ], + "tests": [ + "assert((function(){if(multiply == 80 && editor.getValue().match(/\\*/g)){return(true);}else{return(false);}})(), 'Multiply should be the result of a sum and be equal to 80');" + ], + "challengeSeed": [ + "var multiply = 8 * 0;//equals 80", + "", + "", + "", + "(function(z){return('multiply='+z);})(multiply);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb6bdef", + "name": "Magical Maths Division", + "dashedName": "waypoint-magical-maths-division", + "difficulty": "9.9814", + "description": [ + "", + "In JavaScript whole numbers (called integers) can be really easily to preform mathematical functions", + "Let's try a few of the most commonly used ones now", + "We use / for division", + "Replace the 0 with correct number to achieve the result in the comment." + ], + "tests": [ + "assert((function(){if(divide == 2 && editor.getValue().match(/\\//g)){return(true);}else{return(false);}})(), 'Divide should be the result of a sum and be equal to 2');" + ], + "challengeSeed": [ + "var divide = 66 / 0;//equals 2", + "", + "", + "", + "(function(z){return('divide='+z);})(divide);" + ], + "challengeType": 1 + }, + { + "_id": "bh1111c1c11feddfaeb4bdef", + "name": "Creating Decimals", + "dashedName": "waypoint-creating-decimals", + "difficulty": "9.9815", + "description": [ + "", + "in JavaScript we can can work with decimal numbers", + "These decal numbers are known as floats.", + "Let's create a float now called myFloat and give it a value" + ], + "tests": [ + "assert((function(){if(typeof(myFloat) != 'undefined' && typeof(myFloat) == 'number' && editor.getValue().match(/\\./g).length >=2){return(true);}else{return(false);}})(), 'myFloat should be a decimal point number');" + ], + "challengeSeed": [ + "//var ourFloat = 5.7", + "//Create a number with a decimal point here called myFloat", + "", + "", + "", + "", + "if(typeof(myFloat) != 'undefined'){(function(z){return(z);})(myFloat);}" ], "challengeType": 1 }, @@ -371,7 +389,7 @@ "_id": "bd7993c9c69feddfaeb7bdef", "name": "Working With Decimals", "dashedName": "waypoint-working-with-decimals", - "difficulty": "9.9815", + "difficulty": "9.98151", "description": [ "", "in JavaScript we can can work with decimal numbers", @@ -379,20 +397,16 @@ "Let's take a look at working with floats now" ], "tests": [ - "assert(add == 13.5, 'The result of add should be 13.5');", - "assert(subtract == 7.25, 'The result of subtract should be 7.25');", "assert(multiply == 15, 'The result of multiply should be 3.75');", "assert(divide == 2.25, 'The result of divide should be 2.25');" ], "challengeSeed": [ - "var add = 9 + _;//equals 13.5", - "var subtract = 12 - _;//equals 7.25", - "var multiply = 3.75 * _;//equals 15", - "var divide = 9 / _;//equals 2.25", + "var multiply = 3.75 * 0;//equals 15", + "var divide = 9 / 0;//equals 2.25", "", "", "", - "(function(w,x,y,z){return('add='+w+', subtract='+x+', multiply='+y+', divide='+z);})(add,subtract,multiply,divide);" + "(function(y,z){return('multiply='+y+', divide='+z);})(multiply,divide);" ], "challengeType": 1 }, @@ -405,18 +419,17 @@ "", "In JavaScript we can store lists or collections of data in what are called arrays", "Arrays are distinguished by the [ and ] around the data. Each piece of data is separated be a , ", - "Now let's create a new array called myArray with a string , a number and a array with a , separating each one", + "Now let's create a new array called myArray with a string and a number with a , separating each one", "Refer to the example if you get stuck", "" ], "tests": [ "assert(typeof(myArray) == 'object', 'myArray should be an array');", - "assert(myArray[0] !== undefined && typeof(myArray[0]) == 'string', 'The fist item in myArray should be a string');", - "assert(myArray[1] !== undefined && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number');", - "assert(myArray[2] !== undefined && typeof(myArray[2]) == 'object', 'The third item in myArray should be an array');" + "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The fist item in myArray should be a string');", + "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'The second item in myArray should be a number');" ], "challengeSeed": [ - "//var array = ['John', 23, [2, 'cat']];", + "//var array = ['John', 23];", "", "var myArray = [];", "", @@ -425,11 +438,97 @@ ], "challengeType": 1 }, + { + "_id":"bh1111c1c11feddfaeb7bdef", + "name":"Nesting Arrays", + "dashedName":"waypoint-nesting-arrays", + "difficulty":"9.98161", + "description":[ + "", + "We are also able to create arrays within arrays. This technique is called nesting.", + "Let's now go create a nested array called myArray" + ], + "tests":[ + "assert((function(){if(typeof(myArray) !== 'undefined' && typeof(myArray) === 'object' && typeof(myArray[0]) !== 'undefined' && typeof(myArray) === 'object'){return(true);}else{return(false);}})(), 'myArray should contain at least one array');" + ], + "challengeSeed":[ + "var myArray = [];", + "", + "", + "if(typeof(myArray) !== 'undefined'){(function(){return(myArray);})();}" + ], + "challengeType": 1 + }, + { + "_id":"bg9997c9c79feddfaeb9bdef", + "name":"Accessing data with Indexes", + "dashedName":"waypoint-accessing-data-with-indexes", + "difficulty":"9.9817", + "description":[ + "", + "Once an array has been created we can access the data we have stored in them using indexes", + "Indexes are written in the same way as bracket notation that we covered earlier", + "Example:", + "", + "var array = [1,2,3];", + "array[0];//equals 1", + "var data = array[1];", + "", + "Create a var called data and set it to equal the first value of myArray" + ], + "tests":[ + "assert((function(){if(typeof(myArray) != 'undefined' && typeof(data) != 'undefined' && myArray[0] == data){return(true);}else{return(false);}})(), 'the variable data should equal the first value of myArray');" + ], + "challengeSeed":[ + "//var ourArray = [1,2,3]", + "//var ourData = ourArray[0]//equals 1", + "", + "var myArray = [1,2,3];", + "", + "", + "", + "if(typeof(myArray) != 'undefined' && typeof(data) != 'undefined'){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', data = ' + JSON.stringify(z));})(myArray, data);}" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c11feddfaeb8bdef", + "name":"Modifying Data With Indexes", + "dashedName":"waypoint-modifying-data-with-indexes", + "difficulty":"9.98171", + "description":[ + "", + "We are able to modify the data store in an array be using indexes", + "Example:", + "", + "var ourArray = [1,2,3];", + "ourArray[0] = 3;//ourArray equals [3,2,3]", + "", + "Now Let's modify myArray using an index", + "" + ], + "tests":[ + "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return(true);}else{return(false);}})(), 'myArray should now be [3,2,3]');", + "assert((function(){if(editor.getValue().match(/[0]/g).length >= 2 && editor.getValue().match(/=/g).length >= 2){return(true);}else{return(false);}})(), 'You should be using indexes to modify the values in myArray');" + ], + "challengeSeed":[ + "//var ourArray = [1,2,3];", + "//ourArray[0] = 3;", + "", + "var myArray = [1,2,3];", + "", + "", + "", + "", + "if(typeof(myArray) != 'undefined'){(function(){return(myArray);})();}" + ], + "challengeType": 1 + }, { "_id": "bg9994c9c69feddfaeb9bdef", "name": "Manipulating Arrays With pop()", "dashedName": "waypoint-manipulating-arrays-with-pop", - "difficulty": "9.9817", + "difficulty": "9.9818", "description": [ "", "When and array has been defined we still have the ability to make changes to it afterwards", @@ -527,38 +626,6 @@ ], "challengeType": 1 }, - { - "_id":"bg9997c9c79feddfaeb9bdef", - "name":"Manipulating Arrays Indexes", - "dashedName":"waypoint-manipulating-arrays-indexes", - "difficulty":"9.9818", - "description":[ - "", - "With Arrays, we can access and modify the data inside them using indexes much like we did with strings. The major difference between using indexes with arrays versus using them in strings is that you cannot modify data in a string using and index.", - "In Arrays though we are freely allowed to change values in an array.", - "Let's have a go and accessing the last item in myArray and changing the middle value tp 25 ", - "Take a look at the commented out example above if you get stuck" - ], - "tests":[ - "assert((function(a){if(a[0] != undefined && a[0] == 'Paul' && a[1] != undefined && a[1] == 25 && a[2][0] != undefined && a[2][0] == 'dog' && a[2][1] != undefined && a[2][1] == 3){return(true);}else{return(false);}})(myArray), 'myArray should be [\"John\", \"David\",\"Paul\"]');", - "assert((function(l){if(l[0] != undefined && l[0] == 'dog' && l[1] != undefined && l[1] == 3){return(true);}else{return(false);}})(last), 'The last variable in myArray should be [\"dog\", 3]');" - ], - "challengeSeed":[ - "//var ourArray = ['Alpha', 'Beta', 'Gamma'];", - "//ourArray[0];//the first item in the array is 'Alpha'", - "//ouArray[1] = 'Omega';//The second item int the array is nom Omega instead of Beta", - "", - "var myArray = ['Paul', 23, ['dog', 3]];", - "var last = _;//Set this to be the last variable in the array using an index", - "", - "//Now set the second item in the Array to be 25 using an index'", - "", - "", - "", - "(function(y,z){return('myArray = ' + JSON.stringify(y) + ', last = ' + JSON.stringify(z));})(myArray, last);" - ], - "challengeType": 1 - }, { "_id":"bg9997c9c89feddfaeb9bdef", "name":"Make it functional", @@ -569,123 +636,31 @@ "In JavaScript we can divide up our code into separate and reusable parts called functions", "here's and example of a function", "", - "function funcitonName (one, two ,three){", - " /*Some Code*/", + "function functionName (a, b){", + " return(a + b);", "}", "", "our function can be called like this", "functionName();", - "Let's try creating and calling a function now." + "Let's try creating and calling a function now called myFunction" ], "tests":[ - "assert(f==data);" + "assert((function(){if(typeof(f) !== 'undefined' && typeof(f) === 'number' && f === 9){return(true);}else{return(false);}})(), 'Your function should return the value of a + b');" ], "challengeSeed":[ - "//var ourData = 'function called!';", - "//function ourFunction(ourData) {/*ourData is being passed to this function as an argument*/", - "//return(data);", - "//}", - "", - "var data = 'Function Called!';", - "", - "//Create a function called myFunction that takes data as an argument and returns it like the example above", - "", + "var a = 4;", + "var b = 5;", + "//Don not modify the above!", + "//Create a function called myFunction that adds a and b", "", "", "", "", "//Don't modify this!", - "var f=myFunction(data);", - "(function(){var f=myFunction(data);return(f);})('');" - ], - "challengeType": 1 - }, - { - "_id":"bg9997c9c99feddfaeb9bdef", - "name":"Doing things inside functions", - "dashedName":"waypoint-doing-things-inside-functions", - "difficulty":"9.982", - "description":[ - "", - "A function that takes the value you give it and returns it isn't very useful! So now let's get our functions to do something!", - "Starting from where we were last time let's make our function revers whatever we give it by chaining .split('') , .reverse() and .join('') " - ], - "tests":[ - "assert(f==data.split('').reverse().join(''), 'myFunction should now return the reversed version of data (!dellaC noitcnuF)');" - ], - "challengeSeed":[ - "//You can reverse strings like this", - "//var notReversed = 'String';", - "//var reversed = notReversed.split('').reverse().join('');", - "", - "var data = 'Function Called!';", - "", - "function myFunction(data){", - " ", - " return(data);", - "}", - "", - "", - "", - "//Don't modify this!", - "var f=myFunction(data);", - "(function(f){return(f);})(f);" - ], - "challengeType": 1 - }, - { - "_id":"bg9997c9c99feddfaeb9bdef", - "name":"Keeping In The Scope Of Things", - "dashedName":"waypoint-keeping-in-the-scope-of-things", - "difficulty":"9.9821", - "description":[ - "", - "All variables are contained in something called a scope .", - "A Scope defines where are variable can be accessed.", - "All variables created outside any functions exist in what is called the global scope ", - "All variables are container or are scope to inside that function.", - "", - "var variable = 'Global Scope'", - "function test(){", - " return(variable);", - "}", - "test();//Returns Global Scope", - "", - "function change(){", - " variable = 'test';", - " return(variable);", - "}", - "", - "change();//Returns test", - "variable //equals Global Scope", - "", - "", - "Let's give this a go!" - ], - "tests":[ - "assert(Global == access(Global), 'access should return your Global var');", - "assert(Global != localChange(Global), 'localChange should return your Global var');" - ], - "challengeSeed":[ - "//Create Your global variable with any value here", - "var Global = _;", - "", - "//Make access() return you global variable", - "function access(){", - " ", - "}", - "", - "access();", - "", - "//Pass you global variable into localChange and modify it within the function", - "function localChange(){", - " ", - "}", - "", - "//Don't forget to call localChange here and pass your global variable", - "", - "", - "(function(x,y,z){return('access returns: ' + y(x) + ' & localChange returns: ' + z(x));})(Global, access, localChange);" + "if(typeof(myFunction) != 'undefined'){", + "var f=myFunction(a,b);", + "(function(){return(f);})();", + "}" ], "challengeType": 1 }, @@ -875,38 +850,224 @@ "challengeType": 1 }, { - "_id":"bh1111c1c11feddfaeb3bdef", - "name":"Looping with recursion", - "dashedName":"waypoint-looping-with-recursion", + "_id":"bh1111c1c11feddfaeb9bdef", + "name":"Random Numbers", + "dashedName":"waypoint-random-numbers", "difficulty":"9.9827", "description":[ "", - "The next method of looping that we'll examine is called recursion", - "A recursive function (a function that uses recursion) is a function that calls itself until a predefined condition is met", - "", - "var ourArray = [];", - "var i = 0;", - "function loop(){", - " ourArray.push(i);", - " i++;", - " if(i < 5){", - " loop()", - " }", - "}", - "", - "ourArray now contains [0,1,2,3,4] ", - "Let's try getting recursion to work by pushing values to an array" + "Random numbers are a very useful for creating random behaviours and games", + "Javascript has a Math.random() method that can generate a random decimal number", + "Let's have a go of Math.random() now be getting myFunction to return a random number" ], "tests":[ - "assert((function(){if(!editor.getValue().match(/do/g) && !editor.getValue().match(/while/g) && !editor.getValue().match(/for/g)){return(true);}else{return(false);}})(), 'You should be using recursion for this!')", - "assert.deepEqual(myArray, [0,1,2,3,4], 'myArray should equal [0,1,2,3,4]');" + "assert(typeof(myFunction()) === 'number', 'myFunction should return a random number');", + "assert((myFunction()+''). match(/\\./g), 'The number returned by myFunction should be a decimal');", + "assert(editor.getValue().match(/Math\\.random/g).length >= 2, 'You should be using Math.random to generate the random decimal number');" ], "challengeSeed":[ - "var myArray = [];", - "//Push the numbers 0-4 to myArray", "", + "function myFunction(){", + " //Change the 0 to Math.random()", + " return(0);", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb1bdef", + "name":"Random Whole Numbers", + "dashedName":"waypoint-random-whole-numbers", + "difficulty":"9.9828", + "description":[ + "", + "While it's great that we can create random decimal numbers it's a lot more useful to generate a random whole number", + "To achieve this we can multiply the random number by ten and use the Math.floor() to convert the decimal number to a whole number", + "This technique gives us a whole number between zero and nine", + "Example:", + "Math.floor(Math.random()*10);", + "Let's give this technique a go now" + ], + "tests":[ + "assert(typeof(myFunction()) == 'number', 'The result of myFunction should be a number');", + "assert(editor.getValue().match(/Math.random/g), 'You should be using Math.random to create a random number');", + "assert(!(''+myFunction()).match(/\\./g), 'You should have multiplied the result of Math.random but 10 to make it a number that\\'s greater then zero');", + "assert(editor.getValue().match(/Math.floor/g), 'You should use Math.floor to remove the decimal part of the number');" + ], + "challengeSeed":[ + "function myFunction(){", + " //Make myFunction return a random number between zero and nine instead of a float", + " return(Math.random());", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb2bdef", + "name":"Random Whole Numbers In a Range", + "dashedName":"waypoint-random-whole-numbers-in-a-range", + "difficulty":"9.9829", + "description":[ + "", + "We can use a certain mathematical expression to get a random number between between twp numbers.", + "Math.floor(Math.random() * (max - min + 1)) + min", + "By using this we can control the output of the random number.", "" ], + "tests":[ + "assert(myFunction() >= min, 'The random number that\\'s generated by myFunction should be greater than or equal to the minimum number');", + "assert(myFunction() <= max, 'The random number that\\'s generated by myFunction should be less than or equal to the maximum number');", + "assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 3 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return(true);}else{return(false);}})(), 'You should be using the function given in the description to calculate the random in number in a range');" + ], + "challengeSeed":[ + " var min = 0;", + " var max = 12;", + "function myFunction(){", + " //Make myFunction return a random number between zero and nine instead of a float", + " return(Math.random());", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb3bdef", + "name":"If Else Statements", + "dashedName":"waypoint-if-else-statements", + "difficulty":"9.983", + "description":[ + "", + "We can use if statements in JavaScript to only execute code if a certain condition is met", + "if statements require some sort of boolean condition evaluate", + "Example:", + "if(1==2){", + " return(true);", + "}", + "else{", + " return(false);", + "}", + "Let's have a go of using if statements now by making a coin-flip game", + "Create an if else statement to return heads if the flip var is zero and to return tails if it's not" + ], + "tests":[ + "assert((function(){if(myFunction() == 'heads' || myFunction() == 'tails'){return(true);}else{return(false);}})(), 'myFunction should either return heads or tails');", + "assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');", + "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');" + ], + "challengeSeed":[ + "function myFunction(){", + " var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", + " //Create and if else statement here to return heads if flip is 0 otherwise return false", + " ", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb6bdef", + "name":"An Intro To RegEx", + "dashedName":"waypoint-an-intro-to-regex", + "difficulty":"9.984", + "description":[ + "", + "RegEx is a powerful tool we can use to find certain words or patterns in strings", + "RegEx can look difficult at first but there's not much to getting it working", + "If we wanted to find the number of times the word \"the\" occured in the string \"The dog chased the cat\" We could use the following RegEx:", + "\/the+\/gi", + "Let's break this down a bit", + "\"The\" is the pattern we want to match", + "\"+\" means we are looking for one or more occurrences of this pattern", + "\"g\" means that it searhces the whole string", + "\"i\" means that we are ignoring the case(upper or lower) of what we are looking for", + "Let's try finding the word and in the string \"John and Alan went to the shop and got some milk\" by replacing the .+ in the currnet RegEx with something that will find the word \"and\" and count how many times it occurs" + ], + "tests":[ + "assert(test==2, 'You\\'re RegEx should have found two occurances of the word \"and\"');", + "assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used this RegEx to find the word \"and\"');" + ], + "challengeSeed":[ + "var test = (function(){", + " var testString = \"John and Alan went to the shop and got some milk\";", + "", + "//Do Not Modify Above", + "", + " var expression = /.+/gi;", + "", + "//Do Not Modify Below", + "", + " return(testString.match(expression).length);", + "})();(function(){return(test);})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb7bdef", + "name":"Finding Numbers", + "dashedName":"waypoint-finding-numbers", + "difficulty":"9.985", + "description":[ + "", + "We can use special selectors in RegEx to select a particular type of value", + "One such selector is the digit selector \\d which is used to grab the numbers in a string", + "It is used like this:", + "/\\d+/g", + "" + ], + "tests":[ + "assert(test === 2, 'Your RegEx should have found two numbers in the testString');", + "assert(editor.getValue().match(/\\/\\\\d\\+\\//gi), 'You should be using the following expression /\\d+/gi to find the numbers in the testString');" + ], + "challengeSeed":[ + "var test = (function(){", + " var testString = \"There's 3 cats but 4 dogs.\"", + "", + "//Do Not Modify Above", + "", + " var expression = /.+/gi;", + "", + "//Do Not Modify Below", + "", + " return(testString.match(expression).length);", + "})();(function(){return(test);})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb8bdef", + "name":"Finding WhiteSpace", + "dashedName":"waypoint-finding-whitespace", + "difficulty":"9.987", + "description":[ + "", + "We can also use selectors like \\s to find spaces in a string", + "It is used like this:", + "/\\s+/g", + "" + ], + "tests":[ + "assert(test === 7, 'Your RegEx should have found seven spaces in the testString');", + "assert(editor.getValue().match(/\\/\\\\s\\+\\//gi), 'You should be using the following expression /\\s+/gi to find the spaces in the testString');" + ], + "challengeSeed":[ + "var test = (function(){", + " var testString = \"How many spaces are there in this sentance.\";", + "", + "//Do Not Modify Above", + "", + " var expression = /.+/gi;", + "", + "//Do Not Modify Below", + "", + " return(testString.match(expression).length);", + "})();(function(){return(test);})();" + ], "challengeType": 1 } ] From 50f356f16fbfe0cefc980a282ac7b0b8483f3754 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 24 Jul 2015 00:38:13 +0100 Subject: [PATCH 09/13] Ready Js Curriculum Added Regex, Random Numbers and If else Challenges --- challenges/basic-javascript.json | 167 ++++++++++++++++++++++++++++++- 1 file changed, 163 insertions(+), 4 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 7bf51368b5..9fb5129929 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -886,12 +886,20 @@ "While it's great that we can create random decimal numbers it's a lot more useful to generate a random whole number", "To achieve this we can multiply the random number by ten and use the Math.floor() to convert the decimal number to a whole number", "This technique gives us a whole number between zero and nine", + "Example:", + "Math.floor(Math.random()*10);", "Let's give this technique a go now" ], - "tests":[], + "tests":[ + "assert(typeof(myFunction()) == 'number', 'The result of myFunction should be a number');", + "assert(editor.getValue().match(/Math.random/g), 'You should be using Math.random to create a random number');", + "assert(!(''+myFunction()).match(/\\./g), 'You should have multiplied the result of Math.random but 10 to make it a number that\\'s greater then zero');", + "assert(editor.getValue().match(/Math.floor/g), 'You should use Math.floor to remove the decimal part of the number');" + ], "challengeSeed":[ "function myFunction(){", " //Make myFunction return a random number between zero and nine instead of a float", + " return(Math.random());", "}", "", "(function(){return(myFunction());})();" @@ -899,16 +907,167 @@ "challengeType": 1 }, { - "_id":"", + "_id":"bh1111c1c12feddfaeb2bdef", "name":"Random Whole Numbers In a Range", "dashedName":"waypoint-random-whole-numbers-in-a-range", "difficulty":"9.9829", "description":[ "", + "We can use a certain mathematical expression to get a random number between between twp numbers.", + "Math.floor(Math.random() * (max - min + 1)) + min", + "By using this we can control the output of the random number.", "" ], - "tests":[], - "challengeSeed":[], + "tests":[ + "assert(myFunction() >= min, 'The random number that\\'s generated by myFunction should be greater than or equal to the minimum number');", + "assert(myFunction() <= max, 'The random number that\\'s generated by myFunction should be less than or equal to the maximum number');", + "assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 3 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return(true);}else{return(false);}})(), 'You should be using the function given in the description to calculate the random in number in a range');" + ], + "challengeSeed":[ + " var min = 0;", + " var max = 12;", + "function myFunction(){", + " //Make myFunction return a random number between zero and nine instead of a float", + " return(Math.random());", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb3bdef", + "name":"If Else Statements", + "dashedName":"waypoint-if-else-statements", + "difficulty":"9.983", + "description":[ + "", + "We can use if statements in JavaScript to only execute code if a certain condition is met", + "if statements require some sort of boolean condition evaluate", + "Example:", + "if(1==2){", + " return(true);", + "}", + "else{", + " return(false);", + "}", + "Let's have a go of using if statements now by making a coin-flip game", + "Create an if else statement to return heads if the flip var is zero and to return tails if it's not" + ], + "tests":[ + "assert((function(){if(myFunction() == 'heads' || myFunction() == 'tails'){return(true);}else{return(false);}})(), 'myFunction should either return heads or tails');", + "assert(editor.getValue().match(/if/g).length >= 3, 'You should have created a new if statement');", + "assert(editor.getValue().match(/else/g).length >= 2, 'You should have created a new else statement');" + ], + "challengeSeed":[ + "function myFunction(){", + " var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;", + " //Create and if else statement here to return heads if flip is 0 otherwise return false", + " ", + "}", + "", + "(function(){return(myFunction());})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb6bdef", + "name":"An Intro To RegEx", + "dashedName":"waypoint-an-intro-to-regex", + "difficulty":"9.984", + "description":[ + "", + "RegEx is a powerful tool we can use to find certain words or patterns in strings", + "RegEx can look difficult at first but there's not much to getting it working", + "If we wanted to find the number of times the word \"the\" occured in the string \"The dog chased the cat\" We could use the following RegEx:", + "\/the+\/gi", + "Let's break this down a bit", + "\"The\" is the pattern we want to match", + "\"+\" means we are looking for one or more occurrences of this pattern", + "\"g\" means that it searhces the whole string", + "\"i\" means that we are ignoring the case(upper or lower) of what we are looking for", + "Let's try finding the word and in the string \"John and Alan went to the shop and got some milk\" by replacing the .+ in the currnet RegEx with something that will find the word \"and\" and count how many times it occurs" + ], + "tests":[ + "assert(test==2, 'You\\'re RegEx should have found two occurances of the word \"and\"');", + "assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used this RegEx to find the word \"and\"');" + ], + "challengeSeed":[ + "var test = (function(){", + " var testString = \"John and Alan went to the shop and got some milk\";", + "", + "//Do Not Modify Above", + "", + " var expression = /.+/gi;", + "", + "//Do Not Modify Below", + "", + " return(testString.match(expression).length);", + "})();(function(){return(test);})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb7bdef", + "name":"Finding Numbers", + "dashedName":"waypoint-finding-numbers", + "difficulty":"9.985", + "description":[ + "", + "We can use special selectors in RegEx to select a particular type of value", + "One such selector is the digit selector \\d which is used to grab the numbers in a string", + "It is used like this:", + "/\\d+/g", + "" + ], + "tests":[ + "assert(test === 2, 'Your RegEx should have found two numbers in the testString');", + "assert(editor.getValue().match(/\\/\\\\d\\+\\//gi), 'You should be using the following expression /\\d+/gi to find the numbers in the testString');" + ], + "challengeSeed":[ + "var test = (function(){", + " var testString = \"There's 3 cats but 4 dogs.\"", + "", + "//Do Not Modify Above", + "", + " var expression = /.+/gi;", + "", + "//Do Not Modify Below", + "", + " return(testString.match(expression).length);", + "})();(function(){return(test);})();" + ], + "challengeType": 1 + }, + { + "_id":"bh1111c1c12feddfaeb8bdef", + "name":"Finding WhiteSpace", + "dashedName":"waypoint-finding-whitespace", + "difficulty":"9.987", + "description":[ + "", + "We can also use selectors like \\s to find spaces in a string", + "It is used like this:", + "/\\s+/g", + "" + ], + "tests":[ + "assert(test === 7, 'Your RegEx should have found seven spaces in the testString');", + "assert(editor.getValue().match(/\\/\\\\s\\+\\//gi), 'You should be using the following expression /\\s+/gi to find the spaces in the testString');" + ], + "challengeSeed":[ + "var test = (function(){", + " var testString = \"How many spaces are there in this sentance.\";", + "", + "//Do Not Modify Above", + "", + " var expression = /.+/gi;", + "", + "//Do Not Modify Below", + "", + " return(testString.match(expression).length);", + "})();(function(){return(test);})();" + ], "challengeType": 1 } ] From d6a27326a3dd8cf03913ffff5b967ff017d9cee6 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sat, 25 Jul 2015 20:22:13 -0700 Subject: [PATCH 10/13] Fix dup id's in basic javascript --- challenges/basic-javascript.json | 4 ++-- jobs.json | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index b47d31002e..21911500fe 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -313,7 +313,7 @@ "challengeType": 1 }, { - "id": "cf1111c1c11feddfaeb5bdef", + "id": "cf1231c1c11feddfaeb5bdef", "name": "Magical Maths Multiplication", "dashedName": "waypoint-magical-maths-multiplication", "difficulty": "9.98143", @@ -361,7 +361,7 @@ "challengeType": 1 }, { - "id": "cf1111c1c11feddfaeb4bdef", + "id": "cf1391c1c11feddfaeb4bdef", "name": "Creating Decimals", "dashedName": "waypoint-creating-decimals", "difficulty": "9.9815", diff --git a/jobs.json b/jobs.json index 3ba4fad93e..1b5c427738 100644 --- a/jobs.json +++ b/jobs.json @@ -4,27 +4,31 @@ "company": "Livestream", "position": "Junior Backend Developer (Node.js)", "logoUrl": "https://s3.amazonaws.com/prod-heroku/greenhouse_job_boards/logos/000/001/189/resized/livestream_logo-rgb_standard-cc718e67ce1a0f6fa400f609bdefe605.png?1429547161", - "postingUrl": "https://boards.greenhouse.io/livestream/jobs/59458?t=ek25h0#.VWeTk1xVhBc?source=freecodecamp.com" + "postingUrl": "https://boards.greenhouse.io/livestream/jobs/59458?t=ek25h0#.VWeTk1xVhBc?source=freecodecamp.com", + "description": "foo job" }, { "id": "bd7167d8c442cbafaeb5bdef", "company": "Adobe", "position": "Junior JavaScript Engineer", "logoUrl": "http://cdn-3.famouslogos.us/images/adobe-logo.jpg", - "postingUrl": "https://adobe.taleo.net/careersection/2/jobdetail.ftl?job=32619&lang=en" + "postingUrl": "https://adobe.taleo.net/careersection/2/jobdetail.ftl?job=32619&lang=en", + "description": "foo job" }, { "id": "bd7167d8c443cbafaeb5bdef", "company": "Bookspan", "position": "Full Stack JavaScript Developer (Junior)", "logoUrl": "https://tm-prod.global.ssl.fastly.net/uploaded/companies/227/small_logo.png?v=db9dbe", - "postingUrl": "http://bookspan.theresumator.com/apply/10190b666b74087b537f4659756f7c5679000704722064232c1d2e3b2b102501310437/Fullstack-Javascript-Developer-junior?source=freecodecamp.com&sid=zvi9YD9OcHwoDZNgM3XI9uPszGvqxJo6eHf" + "postingUrl": "http://bookspan.theresumator.com/apply/10190b666b74087b537f4659756f7c5679000704722064232c1d2e3b2b102501310437/Fullstack-Javascript-Developer-junior?source=freecodecamp.com&sid=zvi9YD9OcHwoDZNgM3XI9uPszGvqxJo6eHf", + "description": "foo job" }, { "id": "bd7167d8c444cbafaeb5bdef", "company": "Good Eggs", "position": "Full Stack Developer", "logoUrl": "https://d1qb2nb5cznatu.cloudfront.net/startups/i/72165-64efbd521cdfe3357c811758f5436e7d-medium_jpg.jpg", - "postingUrl": "http://www.jobscore.com/jobs2/goodeggs/full-stack-developer/cQ_hd-0USr4Om7eJe4iefn?Board=freecodecamp.com" + "postingUrl": "http://www.jobscore.com/jobs2/goodeggs/full-stack-developer/cQ_hd-0USr4Om7eJe4iefn?Board=freecodecamp.com", + "description": "foo job" } ] From d8110efd061f81073997244dec0b9ff0e4c13163 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sat, 25 Jul 2015 21:32:18 -0700 Subject: [PATCH 11/13] show jobs route up --- jobs.json | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/jobs.json b/jobs.json index 1b5c427738..2425baa522 100644 --- a/jobs.json +++ b/jobs.json @@ -3,32 +3,28 @@ "id": "bd7167d8c441cbafaeb5bdef", "company": "Livestream", "position": "Junior Backend Developer (Node.js)", - "logoUrl": "https://s3.amazonaws.com/prod-heroku/greenhouse_job_boards/logos/000/001/189/resized/livestream_logo-rgb_standard-cc718e67ce1a0f6fa400f609bdefe605.png?1429547161", - "postingUrl": "https://boards.greenhouse.io/livestream/jobs/59458?t=ek25h0#.VWeTk1xVhBc?source=freecodecamp.com", + "logo": "https://s3.amazonaws.com/prod-heroku/greenhouse_job_boards/logos/000/001/189/resized/livestream_logo-rgb_standard-cc718e67ce1a0f6fa400f609bdefe605.png?1429547161", "description": "foo job" }, { "id": "bd7167d8c442cbafaeb5bdef", "company": "Adobe", "position": "Junior JavaScript Engineer", - "logoUrl": "http://cdn-3.famouslogos.us/images/adobe-logo.jpg", - "postingUrl": "https://adobe.taleo.net/careersection/2/jobdetail.ftl?job=32619&lang=en", + "logo": "http://cdn-3.famouslogos.us/images/adobe-logo.jpg", "description": "foo job" }, { "id": "bd7167d8c443cbafaeb5bdef", "company": "Bookspan", "position": "Full Stack JavaScript Developer (Junior)", - "logoUrl": "https://tm-prod.global.ssl.fastly.net/uploaded/companies/227/small_logo.png?v=db9dbe", - "postingUrl": "http://bookspan.theresumator.com/apply/10190b666b74087b537f4659756f7c5679000704722064232c1d2e3b2b102501310437/Fullstack-Javascript-Developer-junior?source=freecodecamp.com&sid=zvi9YD9OcHwoDZNgM3XI9uPszGvqxJo6eHf", + "logo": "https://tm-prod.global.ssl.fastly.net/uploaded/companies/227/small_logo.png?v=db9dbe", "description": "foo job" }, { "id": "bd7167d8c444cbafaeb5bdef", "company": "Good Eggs", "position": "Full Stack Developer", - "logoUrl": "https://d1qb2nb5cznatu.cloudfront.net/startups/i/72165-64efbd521cdfe3357c811758f5436e7d-medium_jpg.jpg", - "postingUrl": "http://www.jobscore.com/jobs2/goodeggs/full-stack-developer/cQ_hd-0USr4Om7eJe4iefn?Board=freecodecamp.com", + "logo": "https://d1qb2nb5cznatu.cloudfront.net/startups/i/72165-64efbd521cdfe3357c811758f5436e7d-medium_jpg.jpg", "description": "foo job" } ] From d4ff414dc81b9456cba153d67c84fe859582018c Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sat, 25 Jul 2015 21:59:52 -0700 Subject: [PATCH 12/13] update jobs model and jobs seed --- jobs.json | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/jobs.json b/jobs.json index 2425baa522..041a54f16f 100644 --- a/jobs.json +++ b/jobs.json @@ -1,30 +1,46 @@ [ { "id": "bd7167d8c441cbafaeb5bdef", + "email": "Ada_Gerlach@gmail.com", "company": "Livestream", + "country": "Singapore", + "city": "Morar berg", + "state": "South Dakota", "position": "Junior Backend Developer (Node.js)", "logo": "https://s3.amazonaws.com/prod-heroku/greenhouse_job_boards/logos/000/001/189/resized/livestream_logo-rgb_standard-cc718e67ce1a0f6fa400f609bdefe605.png?1429547161", - "description": "foo job" + "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." }, { "id": "bd7167d8c442cbafaeb5bdef", + "email": "Ada_Gerlach@gmail.com", "company": "Adobe", + "country": "Singapore", + "city": "Morar berg", + "state": "South Dakota", "position": "Junior JavaScript Engineer", "logo": "http://cdn-3.famouslogos.us/images/adobe-logo.jpg", - "description": "foo job" + "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." }, { "id": "bd7167d8c443cbafaeb5bdef", + "email": "Ada_Gerlach@gmail.com", "company": "Bookspan", + "country": "Singapore", + "city": "Morar berg", + "state": "South Dakota", "position": "Full Stack JavaScript Developer (Junior)", "logo": "https://tm-prod.global.ssl.fastly.net/uploaded/companies/227/small_logo.png?v=db9dbe", - "description": "foo job" + "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." }, { "id": "bd7167d8c444cbafaeb5bdef", + "email": "Ada_Gerlach@gmail.com", "company": "Good Eggs", + "country": "Singapore", + "city": "Morar berg", + "state": "South Dakota", "position": "Full Stack Developer", "logo": "https://d1qb2nb5cznatu.cloudfront.net/startups/i/72165-64efbd521cdfe3357c811758f5436e7d-medium_jpg.jpg", - "description": "foo job" + "description": "Live life one inhalation and one exhalation at a time. May you be healthy. Let the muscles in your neck and shoulders relax. May you be safe. Reflect on the fragility and preciousness of life. Empty your mind; be formless, shapeless like water. May you be at peace. Take a deep breath. You can do what you set out to do; yes, you can. You can do what you set out to do; yes, you can. Watch each breath appear and disappear, just breathing. Give yourself a break. Live life one inhalation and one exhalation at a time. Give yourself a break. Just acknowledge what's there and let be. You can get through this. Open your heart to change, forgiveness and lovingkindness. Love is the first seed of the soul. It will be ok. Impermanence and change is a powerful teacher and teaching. Bring love into your heart, into your breath and into your being. Briefly notice any emotions, thoughts or sensations that may be driving fear and anxiety and let them be. This discomfort will pass. Bring love into your heart, into your breath and into your being. Take a deep breath. Reflect on the fragility and preciousness of life." } ] From edbab55c988d6e4dea7c728054171ca9f44731f0 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Sun, 26 Jul 2015 07:56:35 -0700 Subject: [PATCH 13/13] Display contact information for job and size thumbnail --- jobs.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jobs.json b/jobs.json index 041a54f16f..5850dc8aba 100644 --- a/jobs.json +++ b/jobs.json @@ -2,6 +2,7 @@ { "id": "bd7167d8c441cbafaeb5bdef", "email": "Ada_Gerlach@gmail.com", + "phone": "1-140-557-0727", "company": "Livestream", "country": "Singapore", "city": "Morar berg", @@ -23,7 +24,7 @@ }, { "id": "bd7167d8c443cbafaeb5bdef", - "email": "Ada_Gerlach@gmail.com", + "phone": "1-140-557-0727", "company": "Bookspan", "country": "Singapore", "city": "Morar berg",