diff --git a/.gitignore b/.gitignore
index 86cbd7b0c8..0f96fb3ee1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,5 +30,20 @@ coverage
.remote-sync.json
server/*.bundle.js
-public/js/*.bundle.js
+public/js/bundle*
+
*.map
+
+// revision manifest
+server/rev-manifest.json
+server/manifests/*
+!server/manifests/README.md
+
+public/js/main*
+public/js/commonFramework*
+public/js/sandbox*
+public/js/iFrameScripts*
+public/js/plugin*
+public/css/main*
+
+server/rev-manifest.json
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..6830f00dc5
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,12 @@
+We're getting a lot of duplicate issues and bug reports that just aren't reporting actual bugs.
+So, before you submit your issue, please read the [Help I've Found a Bug](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Help-I've-Found-a-Bug) wiki page.
+
+We welcome pull requests from Free Code Camp campers (our students) and seasoned JavaScript developers alike! Follow these steps to contribute:
+
+1. Check our [public Waffle Board](https://waffle.io/freecodecamp/freecodecamp).
+2. Pick an issue that nobody has claimed and start working on it. If your issue isn't on the board, open an issue. If you think you can fix it yourself, start working on it. Feel free to ask for help in our [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp).
+3. Fork the project ([Need help with forking a project?](https://help.github.com/articles/fork-a-repo/)). You'll do all of your work on your forked copy.
+4. Create a branch specific to the issue or feature you are working on. Push your work to that branch. ([Need help with branching?](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches))
+5. Name the branch something like `fix/xxx` or `feature/xxx` where `xxx` is a short description of the changes or feature you are attempting to add. For example `fix/email-login` would be a branch where I fix something specific to email login.
+6. You should have [ESLint running in your editor](http://eslint.org/docs/user-guide/integrations.html), and it will highlight anything doesn't conform to [Free Code Camp's JavaScript Style Guide](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Free-Code-Camp-JavaScript-Style-Guide) (you can find a summary of those rules [here](https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/.eslintrc). Please do not ignore any linting errors, as they are meant to **help** you and to ensure a clean and simple code base. Make sure none of your JavaScript is longer than 80 characters per line.
+7. Once your code is ready, submit a [pull request](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Pull-Request-Contribute) from your branch to Free Code Camp's `staging` branch. We'll do a quick code review and give you feedback, then iterate from there. It may also be helpful to read about git [rebasing](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/git-rebase).
diff --git a/README.md b/README.md
index d62477d7bd..9b0c87d631 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
[](https://waffle.io/freecodecamp/freecodecamp/metrics)
@@ -7,7 +7,7 @@
Welcome to Free Code Camp's open source codebase!
=======================
-Free Code Camp is an open-source community of busy people who learn to code, then build projects for nonprofits.
+Free Code Camp is an open-source community of busy people who learn to code and build projects for nonprofits.
Our campers (students) start by working through our free, self-paced, browser-based curriculum. Next, they build several practice projects. Finally, we pair two campers together with a stakeholder from a nonprofit organization, and help them build the solution the nonprofit has requested.
@@ -24,7 +24,7 @@ This code is running live at [FreeCodeCamp.com](http://www.FreeCodeCamp.com). We
Wiki
------------
-We would love your help expanding our [wiki](https://github.com/freecodecamp/freecodecamp/wiki) with more information about learning to code and getting a coding job.
+We would love your help expanding our [wiki](https://github.com/freecodecamp/freecodecamp/wiki). Our goal is to become a great resource for people learning to code, building local coding communities, and applying for coding jobs.
Contributing
------------
@@ -35,10 +35,9 @@ We welcome pull requests from Free Code Camp campers (our students) and seasoned
2. Pick an issue that nobody has claimed and start working on it. If your issue isn't on the board, open an issue. If you think you can fix it yourself, start working on it. Feel free to ask for help in our [Gitter](https://gitter.im/FreeCodeCamp/FreeCodeCamp).
3. Fork the project ([Need help with forking a project?](https://help.github.com/articles/fork-a-repo/)). You'll do all of your work on your forked copy.
4. Create a branch specific to the issue or feature you are working on. Push your work to that branch. ([Need help with branching?](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches))
-5. Name the branch something like `user-xxx` where user is your username and xxx is the issue number you are addressing.
-6. You should have [ESLint running in your editor](http://eslint.org/docs/user-guide/integrations.html), and it will highlight anything doesn't conform to [AirBnB's JavaScript Style Guide](https://github.com/airbnb/javascript). Please do not ignore any linting errors, as they are meant to **help** you. Make sure none of your JavaScript is longer than 80 characters per line.
-7. Once your code is ready, submit a pull request from your branch to Free Code Camp's `staging` branch. We'll do a quick code review and give you feedback, then iterate from there.
-8. Once we accept one of your pull requests, one of the project owners (currently @quincylarson, @terakilobyte, and @berkeleytrue) will add you to our camper contributor group.
+5. Name the branch something like `fix/xxx` or `feature/xxx` where `xxx` is a short description of the changes or feature you are attempting to add. For example `fix/email-login` would be a branch where I fix something specific to email login.
+6. You should have [ESLint running in your editor](http://eslint.org/docs/user-guide/integrations.html), and it will highlight anything doesn't conform to [Free Code Camp's JavaScript Style Guide](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Free-Code-Camp-JavaScript-Style-Guide) (you can find a summary of those rules [here](https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/.eslintrc). Please do not ignore any linting errors, as they are meant to **help** you and to ensure a clean and simple code base. Make sure none of your JavaScript is longer than 80 characters per line.
+7. Once your code is ready, submit a [pull request](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Pull-Request-Contribute) from your branch to Free Code Camp's `staging` branch. We'll do a quick code review and give you feedback, then iterate from there. It may also be helpful to read about git [rebasing](https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/git-rebase).
Prerequisites
-------------
@@ -66,12 +65,13 @@ bower install
# Create a .env file and populate it with the necessary API keys and secrets:
touch .env
+# Install Gulp globally
+npm install -g gulp
```
-Edit your .env file with the following API keys accordingly (if you only use email login, only the MONGOHQ_URL, SESSION_SECRET, MANDRILL_USER and MANDRILL_PASSWORD fields are necessary. Keep in mind if you want to use more services you'll have to get your own API keys for those services.
+Edit your `.env` file with the following API keys accordingly (if you only use email login, only the `MONGOHQ_URL`, `SESSION_SECRET`, `MANDRILL_USER` and `MANDRILL_PASSWORD` fields are necessary. Keep in mind if you want to use more services you'll have to get your own API keys for those services.
```
-
MONGOHQ_URL='mongodb://localhost:27017/freecodecamp'
FACEBOOK_ID=stuff
@@ -104,20 +104,22 @@ COOKIE_SECRET='this is a secret'
PEER=stuff
DEBUG=true
-
```
```bash
-
# Start the mongo server
mongod
+# Create your mongo database.
+# Type "mongo" in your terminal to access the mongo shell
+use freecodecamp
+# Exit the mongo shell with control + d
+
# Seed your database with the challenges
node seed/
# start the application
gulp
-
```
License
diff --git a/bower.json b/bower.json
index cd8cfd5cf3..1f833167fc 100644
--- a/bower.json
+++ b/bower.json
@@ -26,6 +26,7 @@
"moment": "~2.10.2",
"angular-bootstrap": "~0.13.0",
"ramda": "~0.13.0",
- "jshint": "~2.7.0"
+ "jshint": "~2.7.0",
+ "lightbox2": "~2.8.1"
}
}
diff --git a/client/README.md b/client/README.md
index 5ba2586944..b722fceb9c 100644
--- a/client/README.md
+++ b/client/README.md
@@ -1,4 +1,4 @@
-This is the entry point for the client
+This is the entry point for the client code
Code that should only run on the client should be put here.
NOTE(berks): For react specific stuff this should be the entry point
diff --git a/client/commonFramework.js b/client/commonFramework.js
new file mode 100644
index 0000000000..6e5bb4f2cf
--- /dev/null
+++ b/client/commonFramework.js
@@ -0,0 +1,808 @@
+/* globals jailed, CodeMirror, challenge_Id, challenge_Name, challengeType */
+// codeStorage
+var codeStorageFactory = (function($, localStorage) {
+
+ var CodeStorageProps = {
+ version: 0.01,
+ keyVersion: 'saveVersion',
+ keyValue: null,
+ updateWait: 2000,
+ updateTimeoutId: null
+ };
+
+ var CodeStorage = {
+ hasSaved: function() {
+ return this.updateTimeoutId === null;
+ },
+
+ onSave: function(func) {
+ this.eventArray.push(func);
+ },
+
+ setSaveKey: function(key) {
+ this.keyValue = key + 'Val';
+ },
+
+ getStoredValue: function() {
+ return '' + localStorage.getItem(this.keyValue);
+ },
+
+ setEditor: function(editor) {
+ this.editor = editor;
+ },
+
+ isAlive: function() {
+ var val = this.getStoredValue();
+ return val !== 'null' &&
+ val !== 'undefined' &&
+ (val && val.length > 0);
+ },
+
+ updateStorage: function() {
+ if (typeof localStorage !== 'undefined') {
+ var value = this.editor.getValue();
+ localStorage.setItem(this.keyValue, value);
+ } else {
+ console.log('no web storage');
+ }
+ this.updateTimeoutId = null;
+ }
+ };
+
+ function codeStorageFactory(editor, challengeName) {
+ var codeStorage = Object.create(CodeStorage);
+ $.extend(codeStorage, CodeStorageProps);
+ codeStorage.setEditor(editor);
+ codeStorage.setSaveKey(challengeName);
+ return codeStorage;
+ }
+
+ var savedVersion = localStorage.getItem(CodeStorageProps.keyVersion);
+ if (savedVersion === null) {
+ localStorage.setItem(
+ CodeStorageProps.keyVersion,
+ CodeStorageProps.version
+ );
+ }
+
+ return codeStorageFactory;
+}($, localStorage));
+
+var sandBox = (function() {
+
+ var plugin = null;
+
+ var sandBox = {
+ };
+
+ var printCallback;
+
+ // sends the input to the plugin for evaluation
+ function submit(code, callback) {
+ printCallback = callback;
+
+ // postpone the evaluation until the plugin is initialized
+ plugin.whenConnected(function() {
+ if (requests === 0) {
+ startLoading();
+ }
+
+ requests++;
+ plugin.remote.run(code);
+ });
+ }
+
+ // puts the message on the terminal
+ var print = function(cls, msg) {
+ printCallback(cls, msg);
+ };
+
+
+ // will restart the plugin if it does not respond
+ var disconnectTimeout = null;
+ var startLoading = function() {
+ disconnectTimeout = setTimeout(disconnect, 3000);
+ };
+
+ var endLoading = function() {
+ clearTimeout(disconnectTimeout);
+ };
+
+ var disconnect = function() {
+ plugin.disconnect();
+ };
+
+
+ // interface provided to the plugin
+ var api = {
+ output: function(data) {
+ endLoading();
+ // print('input', data.input);
+
+ if (data.error) {
+ print('Error', data);
+ reset();
+ } else {
+ print(null, data);
+ reset();
+ }
+ }
+ };
+
+
+ // obtaining absolute path of this script
+ var scripts = document.getElementsByTagName('script');
+ var path = scripts[scripts.length - 1].src
+ .split('?')[0]
+ .split('/')
+ .slice(0, -1)
+ .join('/') + '/';
+
+ var requests;
+
+ // (re)initializes the plugin
+ var reset = function() {
+ requests = 0;
+ plugin = new jailed.Plugin(path + 'plugin.js', api);
+ plugin.whenDisconnected( function() {
+ // give some time to handle the last responce
+ setTimeout( function() {
+ endLoading();
+ console.log('resetting on fatal plugin error');
+
+ if (challengeType === 0) {
+ codeOutput.setValue(
+ 'Sorry, your code is either too slow, has a fatal error, ' +
+ 'or contains an infinite loop.'
+ );
+ }
+ reset();
+ }, 10);
+ });
+ };
+ reset();
+ sandBox.submit = submit;
+ return sandBox;
+}());
+
+function replaceSafeTags(value) {
+ return value
+ .replace(/fccss/gi, '');
+}
+
+var BDDregex = new RegExp(
+ '(expect(\\s+)?\\(.*\\;)|' +
+ '(assert(\\s+)?\\(.*\\;)|' +
+ '(assert\\.\\w.*\\;)|' +
+ '(.*\\.should\\..*\\;)/'
+);
+
+var isInitRun = false;
+var initPreview = true;
+var editor;
+
+editor = CodeMirror.fromTextArea(document.getElementById('codeEditor'), {
+ lineNumbers: true,
+ mode: 'text',
+ theme: 'monokai',
+ runnable: true,
+ matchBrackets: true,
+ autoCloseBrackets: true,
+ scrollbarStyle: 'null',
+ lineWrapping: true,
+ gutters: ['CodeMirror-lint-markers']
+});
+
+var codeStorage = codeStorageFactory(editor, challenge_Name);
+var myCodeMirror = editor;
+
+editor.on('keyup', function() {
+ clearTimeout(codeStorage.updateTimeoutId);
+ codeStorage.updateTimeoutId = setTimeout(
+ codeStorage.updateStorage.bind(codeStorage),
+ codeStorage.updateWait
+ );
+});
+
+var editorValue;
+var challengeSeed = challengeSeed || null;
+var tests = tests || [];
+var allSeeds = '';
+
+(function() {
+ challengeSeed.forEach(function(elem) {
+ allSeeds += elem + '\n';
+ });
+})();
+
+if (typeof emmetCodeMirror !== 'undefined') {
+ var defaultKeymap = {
+ 'Cmd-E': 'emmet.expand_abbreviation',
+ 'Tab': 'emmet.expand_abbreviation_with_tab',
+ 'Enter': 'emmet.insert_formatted_line_break_only'
+ };
+
+ emmetCodeMirror(editor, defaultKeymap);
+}
+
+editor.setOption('extraKeys', {
+ Tab: function(cm) {
+ if (cm.somethingSelected()) {
+ cm.indentSelection('add');
+ } else {
+ var spaces = Array(cm.getOption('indentUnit') + 1).join(' ');
+ cm.replaceSelection(spaces);
+ }
+ },
+ 'Shift-Tab': function(cm) {
+ if (cm.somethingSelected()) {
+ cm.indentSelection('subtract');
+ } else {
+ var spaces = Array(cm.getOption('indentUnit') + 1).join(' ');
+ cm.replaceSelection(spaces);
+ }
+ },
+ 'Ctrl-Enter': function() {
+ isInitRun = false;
+ bonfireExecute(true);
+ return false;
+ }
+});
+
+editor.setSize('100%', 'auto');
+
+var libraryIncludes = "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ '' +
+ '';
+
+var editorValueForIFrame;
+var iFrameScript = "";
+var delay;
+
+function workerError(error) {
+ var display = $('.runTimeError');
+ var housing = $('#testSuite');
+ if (display.html() !== error) {
+ display.remove();
+ housing.prepend(
+ '
' +
+ error.replace(/j\$/gi, '$').replace(/jdocument/gi, 'document').replace(/jjQuery/gi, 'jQuery') +
+ '
typeof
is a useful method that we can use to check the type of a variable.",
- "One thing to be careful of is that an array has the type objects.",
- "Try using each of these to see the types they have.",
+ "You can use typeof
to check the data structure
, or type, of a variable.",
+ "Note that in JavaScript, arrays are technically a type of object.",
+ "Try using typeof
on each of the following to see which types they have.",
"console.log(typeof(\"\"));
",
"console.log(typeof(0));
",
"console.log(typeof([]));
",
diff --git a/seed/challenges/basejumps.json b/seed/challenges/basejumps.json
index fcad55c0d9..26f091cbcb 100644
--- a/seed/challenges/basejumps.json
+++ b/seed/challenges/basejumps.json
@@ -13,11 +13,11 @@
"If you don't already have Cloud 9 account, create one now at http://c9.io.",
"Now let's get your development environment ready for a new Angular-Fullstack application provided by Yeoman.",
"Open up http://c9.io and sign in to your account.",
- "Click on Create New Workspace at the top right of the c9.io page, then click on the \"Create a new workspace\" popup that appears below it the button after you click on it.",
- "Give your workspace a name.",
+ "Click on the \"+\" icon at the top right of the c9.io page to create a new workspace.",
+ "Give your workspace a name and an optional description.",
"Choose Node.js in the selection area below the name field.",
- "Click the Create button. Then click into your new workspace.",
- "In the lower right hand corner you should see a terminal window. In this window use the following commands. You don't need to know what these mean at this point.",
+ "Click the \"Create workspace\" button.",
+ "Once C9 builds and loads your workspace, you should see a terminal window in the lower right hand corner. In this window use the following commands. You don't need to know what these mean at this point.",
"Never run this command on your local machine. But in your Cloud 9 terminal window, run: rm -rf * && echo \"export NODE_PATH=$NODE_PATH:/home/ubuntu/.nvm/v0.10.35/lib/node_modules\" >> ~/.bashrc && source ~/.bashrc && npm install -g yo grunt grunt-cli generator-angular-fullstack && yo angular-fullstack
",
"Yeoman will prompt you to answer some questions. Answer them like this:",
"What would you like to write scripts with? JavaScript",
@@ -54,7 +54,7 @@
"Run the following command in a Cloud9 terminal prompt tab: npm install grunt-contrib-imagemin --save-dev && npm install --save-dev && heroku login
. At this point, the terminal will prompt you to log in to Heroku from the command line.",
"Now run yo angular-fullstack:heroku
. You can choose a name for your Heroku project, or Heroku will create a random one for you. You can choose whether you want to deploy to servers the US or the EU.",
"Set the config flag for your Heroku environment and add MongoLab for your MongoDB instance by running the following command: cd ~/workspace/dist && heroku config:set NODE_ENV=production && heroku addons:create mongolab
.",
- "As you build your app, you should frequently commit changes to your codebase. Make sure you're in the ~/workspace
directory by running cd ~/workspace
. Then you can this code to stage the changes to your changes and commit them: git commit -am \"your commit message\"
. Note that you should replace \"your commit message\" with a short summary of the changes you made to your code, such as \"added a records controller and corresponding routes\".",
+ "As you build your app, you should frequently commit changes to your codebase. Make sure you're in the ~/workspace
directory by running cd ~/workspace
. Then you can use this code to stage the changes to your changes and commit them: git commit -am \"your commit message\"
. Note that you should replace \"your commit message\" with a short summary of the changes you made to your code, such as \"added a records controller and corresponding routes\".",
"You can push these new commits to GitHub by running git push origin master
, and to Heroku by running grunt --force && grunt buildcontrol:heroku
.",
"If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.",
"Now you're ready to move on to your first Basejump. Click the \"I've completed this challenge\" and move on."
@@ -79,12 +79,12 @@
"User Story: As an authenticated user, I can see the aggregate results of my polls.",
"User Story: As an authenticated user, I can delete polls that I decide I don't want anymore.",
"User Story: As an authenticated user, I can create a poll with any number of possible items.",
- "Bonus User Story: As an unauthenticated user, I can see everyone's polls, but I can't vote on anything.",
+ "Bonus User Story: As an unauthenticated or authenticated user, I can see and vote on everyone's polls.",
"Bonus User Story: As an unauthenticated or authenticated user, I can see the results of polls in chart form. (This could be implemented using Chart.js or Google Charts.)",
"Bonus User Story: As an authenticated user, if I don't like the options on a poll, I can create a new option.",
"If you need further guidance on using Yeoman Angular-Fullstack Generator, check out: https://github.com/clnhll/guidetobasejumps.",
"Once you've finished implementing these user stories, click the \"I've completed this challenge\" button and enter the URLs for both your GitHub repository and your live app running on Heroku. If you pair programmed with a friend, enter his or her Free Code Camp username as well so that you both get credit for completing it.",
- "If you'd like immediate feedback on your project, click this button and paste in a link to your Heroku project. Otherwise, we'll review it before you start your nonprofit projects.meetBonfire()
function should return true
.');"
],
"challengeSeed": [
"function meetBonfire(argument) {",
@@ -46,23 +46,23 @@
"title": "Reverse a String",
"difficulty": "1.01",
"tests": [
- "expect(reverseString('hello')).to.be.a('String');",
- "expect(reverseString('hello')).to.equal('olleh');",
- "expect(reverseString('Howdy')).to.equal('ydwoH');",
- "expect(reverseString('Greetings from Earth')).to.equal('htraE morf sgniteerG');"
+ "assert(typeof(reverseString(\"hello\")) === \"string\", 'reverseString()
should return a string.');",
+ "assert(reverseString(\"hello\") === \"olleh\", '\"hello\"
should become \"olleh\"
.');",
+ "assert(reverseString(\"Howdy\") === \"ydwoH\", '\"Howdy\"
should become \"ydwoH\"
.');",
+ "assert(reverseString(\"Greetings from Earth\") === \"htraE morf sgniteerG\", '\"Greetings from Earth\"
should return \"htraE morf sgniteerG\"
.');"
],
"description": [
"Reverse the provided string.",
"You may need to turn the string into an array before you can reverse it.",
"Your result must be a string.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function reverseString(str) {",
" return str;",
"}",
"",
- "reverseString('hello');"
+ "reverseString(\"hello\", \"\");"
],
"MDNlinks": [
"Global String Object",
@@ -87,25 +87,26 @@
"id": "a302f7aae1aa3152a5b413bc",
"title": "Factorialize a Number",
"tests": [
- "expect(factorialize(5)).to.be.a(\"Number\");",
- "expect(factorialize(5)).to.equal(120);",
- "expect(factorialize(10)).to.equal(3628800);",
- "expect(factorialize(20)).to.equal(2432902008176640000);"
+ "assert(typeof(factorialize(5)) === \"number\", 'factorialize()
should return a number.');",
+ "assert(factorialize(5) === 120, '5
should return 120
.');",
+ "assert(factorialize(10) === 3628800, '10
should return 3,628,800
.');",
+ "assert(factorialize(20) === 2432902008176640000, '20
should return 2,432,902,008,176,640,000
.');",
+ "assert(factorialize(0) === 1, '0
should return 1.');"
],
"difficulty": "1.02",
"description": [
"Return the factorial of the provided integer.",
"If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.",
- "Factorials are often represented with the shorthand notation n!",
- "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120f",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Factorials are often represented with the shorthand notation n!
",
+ "For example: 5! = 1 * 2 * 3 * 4 * 5 = 120
",
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function factorialize(num) {",
" return num;",
"}",
"",
- "factorialize(5);"
+ "factorialize(5, '');"
],
"MDNlinks": [
"Arithmetic Operators"
@@ -132,17 +133,20 @@
"A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.",
"You'll need to remove punctuation and turn everything lower case in order to check for palindromes.",
"We'll pass strings with varying formats, such as \"racecar\", \"RaceCar\", and \"race CAR\" among others.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"tests": [
- "expect(palindrome(\"eye\")).to.be.a(\"boolean\");",
- "assert.deepEqual(palindrome(\"eye\"), true);",
- "assert.deepEqual(palindrome(\"race car\"), true);",
- "assert.deepEqual(palindrome(\"not a palindrome\"), false);",
- "assert.deepEqual(palindrome(\"A man, a plan, a canal. Panama\"), true);",
- "assert.deepEqual(palindrome(\"never odd or even\"), true);",
- "assert.deepEqual(palindrome(\"nope\"), false);",
- "assert.deepEqual(palindrome(\"almostomla\"), false);"
+ "assert(typeof(palindrome(\"eye\")) === \"boolean\", 'palindrome() should return a boolean.');",
+ "assert(palindrome(\"eye\") === true, '\"eye\"
should return true.');",
+ "assert(palindrome(\"race car\") === true, '\"race car\"
should return true.');",
+ "assert(palindrome(\"not a palindrome\") === false, '\"not a palindrome\"
should return false.');",
+ "assert(palindrome(\"A man, a plan, a canal. Panama\") === true, '\"A man, a plan, a canal. Panama\"
should return true.');",
+ "assert(palindrome(\"never odd or even\") === true, '\"never odd or even\"
should return true.');",
+ "assert(palindrome(\"nope\") === false, '\"nope\"
should return false.');",
+ "assert(palindrome(\"almostomla\") === false, '\"almostomla\"
should return false.');",
+ "assert(palindrome(\"My age is 0, 0 si ega ym.\") === true, '\"My age is 0, 0 si ega ym.\"
should return true.');",
+ "assert(palindrome(\"1 eye for of 1 eye.\") === false, '\"1 eye for of 1 eye.\"
should return false.');",
+ "assert(palindrome(\"0_0 (: /-\\ :) 0-0\") === true, '\"0_0 (: /-\\\\ :) 0-0\"
should return true.');"
],
"challengeSeed": [
"function palindrome(str) {",
@@ -178,22 +182,22 @@
"description": [
"Return the length of the longest word in the provided sentence.",
"Your response should be a number.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function findLongestWord(str) {",
" return str.length;",
"}",
"",
- "findLongestWord('The quick brown fox jumped over the lazy dog');"
+ "findLongestWord(\"The quick brown fox jumped over the lazy dog\");"
],
"tests": [
- "expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.be.a('Number');",
- "expect(findLongestWord('The quick brown fox jumped over the lazy dog')).to.equal(6);",
- "expect(findLongestWord('May the force be with you')).to.equal(5);",
- "expect(findLongestWord('Google do a barrel roll')).to.equal(6);",
- "expect(findLongestWord('What is the average airspeed velocity of an unladen swallow')).to.equal(8);",
- "expect(findLongestWord('What if we try a super-long word such as otorhinolaryngology')).to.equal(19);"
+ "assert(typeof(findLongestWord(\"The quick brown fox jumped over the lazy dog\")) === \"number\", 'findLongestWord()
should return a number.');",
+ "assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, '\"The quick brown fox jumped over the lazy dog\"
should return 6
.');",
+ "assert(findLongestWord(\"May the force be with you\") === 5, '\"May the force be with you\"
should return 5
.');",
+ "assert(findLongestWord(\"Google do a barrel roll\") === 6, '\"Google do a barrel roll\"
should return 6
.');",
+ "assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, '\"What is the average airspeed velocity of an unladen swallow\"
should return 8
.');",
+ "assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, '\"What if we try a super-long word such as otorhinolaryngology\"
should return 19
.');"
],
"MDNlinks": [
"String.split()",
@@ -217,22 +221,22 @@
"title": "Title Case a Sentence",
"difficulty": "1.05",
"description": [
- "Return the provided string with the first letter of each word capitalized.",
- "For the purpose of this exercise, you should also capitalize connecting words like 'the' and 'of'.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.",
+ "For the purpose of this exercise, you should also capitalize connecting words like \"the\" and \"of\".",
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function titleCase(str) {",
" return str;",
"}",
"",
- "titleCase(\"I'm a little tea pot\");"
+ "titleCase(\"I'm a little tea pot\", \"\");"
],
"tests": [
- "expect(titleCase(\"I'm a little tea pot\")).to.be.a('String');",
- "expect(titleCase(\"I'm a little tea pot\")).to.equal(\"I'm A Little Tea Pot\");",
- "expect(titleCase(\"sHoRt AnD sToUt\")).to.equal(\"Short And Stout\");",
- "expect(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")).to.equal(\"Here Is My Handle Here Is My Spout\");"
+ "assert(typeof(titleCase(\"I'm a little tea pot\")) === \"string\", 'titleCase()
should return a string.');",
+ "assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", '\"I'm a little tea pot\"
should return \"I'm A Little Tea Pot\"
.');",
+ "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", '\"sHoRt AnD sToUt\"
should return \"Short And Stout\"
.');",
+ "assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", '\"HERE IS MY HANDLE HERE IS MY SPOUT\"
should return \"Here Is My Handle Here Is My Spout\"
');"
],
"MDNlinks": [
"String.charAt()"
@@ -258,7 +262,7 @@
"Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays.",
"Remember, you can iterate through an array with a simple for loop, and access each member with array syntax arr[i] .",
"If you are writing your own Chai.js tests, be sure to use a deep equal statement instead of an equal statement when comparing arrays.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function largestOfFour(arr) {",
@@ -266,12 +270,12 @@
" return arr;",
"}",
"",
- "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);"
+ "largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]], \"\");"
],
"tests": [
- "expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');",
- "(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([27,5,39,1001]);",
- "assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));"
+ "assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, 'largestOfFour()
should return an array.');",
+ "assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27,5,39,1001], '[[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]
should return [27,5,39,1001]
.');",
+ "assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9,35,97,1000000], '[[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]
should return [9, 35, 97, 1000000]
.');"
],
"MDNlinks": [
"Comparison Operators"
@@ -295,7 +299,7 @@
"difficulty": "1.07",
"description": [
"Check if a string (first argument) ends with the given target string (second argument).",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function end(str, target) {",
@@ -304,14 +308,14 @@
" return str;",
"}",
"",
- "end('Bastian', 'n');"
+ "end(\"Bastian\", \"n\", \"\");"
],
"tests": [
- "assert.strictEqual(end('Bastian', 'n'), true, 'should equal true if target equals end of string');",
- "assert.strictEqual(end('Connor', 'n'), false, 'should equal false if target does not equal end of string');",
- "assert.strictEqual(end('Walking on water and developing software from a specification are easy if both are frozen.', 'specification'), false, 'should equal false if target does not equal end of string');",
- "assert.strictEqual(end('He has to give me a new name', 'name'), true, 'should equal true if target equals end of string');",
- "assert.strictEqual(end('If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing', 'mountain'), false, 'should equal false if target does not equal end of string');"
+ "assert(end(\"Bastian\", \"n\") === true, '\"Bastian\", \"n\"
should return true.');",
+ "assert(end(\"Connor\", \"n\") === false, '\"Connor\", \"n\"
should return false.');",
+ "assert(end(\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\") === false, '\"Walking on water and developing software from a specification are easy if both are frozen.\", \"specification\")
should return false.');",
+ "assert(end(\"He has to give me a new name\", \"name\") === true, '\"He has to give me a new name\", \"name\"
should return true.');",
+ "assert(end(\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\") === false, '\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\"
should return false.');"
],
"MDNlinks": [
"String.substr()"
@@ -335,7 +339,7 @@
"difficulty": "1.08",
"description": [
"Repeat a given string (first argument) n times (second argument). Return an empty string if n is a negative number.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function repeat(str, num) {",
@@ -343,12 +347,12 @@
" return str;",
"}",
"",
- "repeat('abc', 3);"
+ "repeat(\"abc\", 3, \"\");"
],
"tests": [
- "assert.strictEqual(repeat('*', 3), '***', 'should repeat a string n times');",
- "assert.strictEqual(repeat('abc', 3), 'abcabcabc', 'should repeat a string n times');",
- "assert.strictEqual(repeat('abc', -2), '', 'should return an empty string for negative numbers');"
+ "assert(repeat(\"*\", 3) === \"***\", '\"*\", 3
should return \"***\"
.');",
+ "assert(repeat(\"abc\", 3) === \"abcabcabc\", '\"abc\", 3
should return \"abcabcabc\"
.');",
+ "assert(repeat(\"abc\", -2) === \"\", '\"abc\", -2
should return \"\"
.');"
],
"MDNlinks": [
"Global String Object"
@@ -371,9 +375,9 @@
"title": "Truncate a string",
"difficulty": "1.09",
"description": [
- "Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a '...' ending.",
+ "Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a \"...\" ending.",
"Note that the three dots at the end add to the string length.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function truncate(str, num) {",
@@ -381,13 +385,13 @@
" return str;",
"}",
"",
- "truncate('A-tisket a-tasket A green and yellow basket', 11);"
+ "truncate(\"A-tisket a-tasket A green and yellow basket\", 11, \"\");"
],
"tests": [
- "expect(truncate('A-tisket a-tasket A green and yellow basket', 11)).to.eqls('A-tisket...');",
- "expect(truncate('Peter Piper picked a peck of pickled peppers', 14)).to.eqls('Peter Piper...');",
- "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length) === 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is = length');",
- "assert.strictEqual(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2), 'A-tisket a-tasket A green and yellow basket', 'should not truncate if string is < length');"
+ "assert(truncate(\"A-tisket a-tasket A green and yellow basket\", 11) === \"A-tisket...\", '\"A-tisket a-tasket A green and yellow basket\", 1
should return \"A-tisket...\"
.');",
+ "assert(truncate(\"Peter Piper picked a peck of pickled peppers\", 14) === \"Peter Piper...\", '\"Peter Piper picked a peck of pickled peppers\", 14
should return \"Peter Piper...\"
.');",
+ "assert(truncate(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) === \"A-tisket a-tasket A green and yellow basket\", '\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length)
should return \"A-tisket a-tasket A green and yellow basket\"
.');",
+ "assert(truncate('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2) === 'A-tisket a-tasket A green and yellow basket', '\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2
should return \"A-tisket a-tasket A green and yellow basket\"
.');"
],
"MDNlinks": [
"String.slice()"
@@ -411,7 +415,7 @@
"difficulty": "1.10",
"description": [
"Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function chunk(arr, size) {",
@@ -419,13 +423,13 @@
" return arr;",
"}",
"",
- "chunk(['a', 'b', 'c', 'd'], 2);"
+ "chunk([\"a\", \"b\", \"c\", \"d\"], 2, \"\");"
],
"tests": [
- "assert.deepEqual(chunk(['a', 'b', 'c', 'd'], 2), [['a', 'b'], ['c', 'd']], 'should return chunked arrays');",
- "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'should return chunked arrays');",
- "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], 'should return chunked arrays');",
- "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'should return the last chunk as remaining elements');"
+ "assert.deepEqual(chunk([\"a\", \"b\", \"c\", \"d\"], 2), [[\"a\", \"b\"], [\"c\", \"d\"]], '[\"a\", \"b\", \"c\", \"d\"], 2
should return [[\"a\", \"b\"], [\"c\", \"d\"]]
.');",
+ "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], '[0, 1, 2, 3, 4, 5]
should return [[0, 1, 2], [3, 4, 5]]
.');",
+ "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 2
should return [[0, 1], [2, 3], [4, 5]]
.');",
+ "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], '[0, 1, 2, 3, 4, 5], 4
should return [[0, 1, 2, 3], [4, 5]]
.');"
],
"MDNlinks": [
"Array.push()"
@@ -449,7 +453,7 @@
"difficulty": "1.11",
"description": [
"Return the remaining elements of an array after chopping off n elements from the head.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function slasher(arr, howMany) {",
@@ -457,12 +461,12 @@
" return arr;",
"}",
"",
- "slasher([1, 2, 3], 2);"
+ "slasher([1, 2, 3], 2, \"\");"
],
"tests": [
- "assert.deepEqual(slasher([1, 2, 3], 2), [3], 'should drop the first two elements');",
- "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'should return all elements when n < 1');",
- "assert.deepEqual(slasher([1, 2, 3], 9), [], 'should return an empty array when n >= array.length');"
+ "assert.deepEqual(slasher([1, 2, 3], 2), [3], '[1, 2, 3], 2, [3]
should return [3]
.');",
+ "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], '[1, 2, 3], 0
should return [1, 2, 3]
.');",
+ "assert.deepEqual(slasher([1, 2, 3], 9), [], '[1, 2, 3], 9
should return []
.');"
],
"MDNlinks": [
"Array.slice()",
@@ -487,26 +491,27 @@
"difficulty": "1.12",
"description": [
"Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.",
- "For example, ['hello', 'Hello'], should return true because all of the letters in the second string are present in the first, ignoring case.",
- "The arguments ['hello', 'hey'] should return false because the string 'hello' does not contain a 'y'.",
- "Lastly, ['Alien', 'line'], should return true because all of the letters in 'line' are present in 'Alien'.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "For example, [\"hello\", \"Hello\"]
, should return true because all of the letters in the second string are present in the first, ignoring case.",
+ "The arguments [\"hello\", \"hey\"]
should return false because the string \"hello\" does not contain a \"y\".",
+ "Lastly, [\"Alien\", \"line\"]
, should return true because all of the letters in \"line\" are present in \"Alien\".",
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function mutation(arr) {",
" return arr;",
"}",
"",
- "mutation(['hello', 'hey']);"
+ "mutation([\"hello\", \"hey\"], \"\");"
],
"tests": [
- "expect(mutation(['hello', 'hey'])).to.be.false;",
- "expect(mutation(['hello', 'Hello'])).to.be.true;",
- "expect(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu'])).to.be.true;",
- "expect(mutation(['Mary', 'Army'])).to.be.true;",
- "expect(mutation(['Mary', 'Aarmy'])).to.be.true;",
- "expect(mutation(['Alien', 'line'])).to.be.true;",
- "expect(mutation(['floor', 'for'])).to.be.true;"
+ "assert(mutation([\"hello\", \"hey\"]) === false, '[\"hello\", \"hey\"]
should return false.');",
+ "assert(mutation([\"hello\", \"Hello\"]) === true, '[\"hello\", \"Hello\"]
should return true.');",
+ "assert(mutation([\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"]) === true, '[\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"]
should return true.');",
+ "assert(mutation([\"Mary\", \"Army\"]) === true, '[\"Mary\", \"Army\"]
should return true.');",
+ "assert(mutation([\"Mary\", \"Aarmy\"]) === true, '[\"Mary\", \"Aarmy\"]
should return true.');",
+ "assert(mutation([\"Alien\", \"line\"]) === true, '[\"Alien\", \"line\"]
should return true.');",
+ "assert(mutation([\"floor\", \"for\"]) === true, '[\"floor\", \"for\"]
should return true.');",
+ "assert(mutation([\"hello\", \"neo\"]) === false, '[\"hello\", \"neo\"]
should return false.');"
],
"MDNlinks": [
"Array.indexOf()"
@@ -526,12 +531,12 @@
},
{
"id": "adf08ec01beb4f99fc7a68f2",
- "title": "Falsey Bouncer",
+ "title": "Falsy Bouncer",
"difficulty": "1.50",
"description": [
- "Remove all falsey values from an array.",
- "Falsey values in javascript are false, null, 0, \"\", undefined, and NaN.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remove all falsy values from an array.",
+ "Falsy values in javascript are false, null, 0, \"\", undefined, and NaN.",
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function bouncer(arr) {",
@@ -539,12 +544,12 @@
" return arr;",
"}",
"",
- "bouncer([7, 'ate', '', false, 9]);"
+ "bouncer([7, \"ate\", \"\", false, 9], \"\");"
],
"tests": [
- "assert.deepEqual(bouncer([7, 'ate', '', false, 9]), [7, 'ate', 9], 'should remove falsey values');",
- "assert.deepEqual(bouncer(['a', 'b', 'c']), ['a', 'b', 'c'], 'should return full array if no falsey elements');",
- "assert.deepEqual(bouncer([false, null, 0]), [], 'should return empty array if all elements are falsey');"
+ "assert.deepEqual(bouncer([7, \"ate\", \"\", false, 9]), [7, \"ate\", 9], '[7, \"ate\", \"\", false, 9]
should return [7, \"ate\", 9]
.');",
+ "assert.deepEqual(bouncer([\"a\", \"b\", \"c\"]), [\"a\", \"b\", \"c\"], '[\"a\", \"b\", \"c\"]
should return [\"a\", \"b\", \"c\"]
.');",
+ "assert.deepEqual(bouncer([false, null, 0, NaN, undefined, '']), [], '[false, null, 0]
should return []
.');"
],
"MDNlinks": [
"Boolean Objects",
@@ -563,52 +568,13 @@
"namePt": "",
"descriptionPt": []
},
- {
- "id": "a8e512fbe388ac2f9198f0fa",
- "title": "Where art thou",
- "difficulty": "1.55",
- "description": [
- "Make a function that looks through an array (first argument) and returns an array of all objects that have equivalent property values (second argument).",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
- ],
- "challengeSeed": [
- "function where(collection, source) {",
- " var arr = [];",
- " // What's in a name?",
- " return arr;",
- "}",
- "",
- "where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });"
- ],
- "tests": [
- "assert.deepEqual(where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' }), [{ first: 'Tybalt', last: 'Capulet' }], 'should return an array of objects');",
- "assert.deepEqual(where([{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }], 'should return with multiples');"
- ],
- "MDNlinks": [
- "Global Object",
- "Object.hasOwnProperty()",
- "Object.keys()"
- ],
- "type": "bonfire",
- "challengeType": 5,
- "nameCn": "",
- "descriptionCn": [],
- "nameFr": "",
- "descriptionFr": [],
- "nameRu": "",
- "descriptionRu": [],
- "nameEs": "",
- "descriptionEs": [],
- "namePt": "",
- "descriptionPt": []
- },
{
"id": "a39963a4c10bc8b4d4f06d7e",
"title": "Seek and Destroy",
"difficulty": "1.60",
"description": [
"You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function destroyer(arr) {",
@@ -616,14 +582,14 @@
" return arr;",
"}",
"",
- "destroyer([1, 2, 3, 1, 2, 3], 2, 3);"
+ "destroyer([1, 2, 3, 1, 2, 3], 2, 3, \"\");"
],
"tests": [
- "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], 'should remove correct values from an array');",
- "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], 'should remove correct values from an array');",
- "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], 'should accept more than two additional arguments');",
- "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], 'should remove correct values from an array');",
- "assert.deepEqual(destroyer(['tree', 'hamburger', 53], 'tree', 53), ['hamburger'], 'should handle NaN-elements');"
+ "assert.deepEqual(destroyer([1, 2, 3, 1, 2, 3], 2, 3), [1, 1], '[1, 2, 3, 1, 2, 3], 2, 3
should return [1, 1]
.');",
+ "assert.deepEqual(destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3), [1, 5, 1], '[1, 2, 3, 5, 1, 2, 3], 2, 3
should return [1, 5, 1]
.');",
+ "assert.deepEqual(destroyer([3, 5, 1, 2, 2], 2, 3, 5), [1], '[3, 5, 1, 2, 2], 2, 3, 5
should return [1]
.');",
+ "assert.deepEqual(destroyer([2, 3, 2, 3], 2, 3), [], '[2, 3, 2, 3], 2, 3
should return []
.');",
+ "assert.deepEqual(destroyer([\"tree\", \"hamburger\", 53], \"tree\", 53), [\"hamburger\"], '[\"tree\", \"hamburger\", 53], \"tree\", 53)
should return [\"hamburger\"]
.');"
],
"MDNlinks": [
"Arguments object",
@@ -649,7 +615,7 @@
"description": [
"Return the lowest index at which a value (second argument) should be inserted into a sorted array (first argument).",
"For example, where([1,2,3,4], 1.5) should return 1 because it is greater than 1 (0th index), but less than 2 (1st index).",
- "Remember to use Read-Search-Ask if you get stuck. Write your own code."
+ "Remember to use Read-Search-Ask if you get stuck. Write your own code."
],
"challengeSeed": [
"function where(arr, num) {",
@@ -657,14 +623,18 @@
" return num;",
"}",
"",
- "where([40, 60], 50);"
+ "where([40, 60], 50, \"\");"
],
"MDNlinks": [
"Array.sort()"
],
"tests": [
- "expect(where([10, 20, 30, 40, 50], 35)).to.equal(3);",
- "expect(where([10, 20, 30, 40, 50], 30)).to.equal(2);"
+ "assert(where([10, 20, 30, 40, 50], 35) === 3, '[10, 20, 30, 40, 50], 35
should return 3
.');",
+ "assert(where([10, 20, 30, 40, 50], 30) === 2, '[10, 20, 30, 40, 50], 30)
should return 2
.');",
+ "assert(where([40, 60], 50) === 1, '[40, 60,], 50
should return 1
.');",
+ "assert(where([5, 3, 20, 3], 3) === 0, '[5, 3, 20, 3], 3
should return 0
.');",
+ "assert(where([2, 20, 10], 1) === 0, '[2, 20, 10], 1
should return 0
.');",
+ "assert(where([2, 5, 10], 15) === 3, '[2, 5, 10], 15
should return 3
.');"
],
"type": "bonfire",
"challengeType": 5,
diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json
index 348cd4b189..e3542ee41d 100644
--- a/seed/challenges/basic-javascript.json
+++ b/seed/challenges/basic-javascript.json
@@ -13,12 +13,13 @@
"// This is a comment.
",
"The slash-star-star-slash comment will comment out everything between the /*
and the */
characters:",
"/* This is also a comment */
",
- "Try creating one of each."
+ "Try creating one of each.",
+ "And one more thing you need to notice. Starting at this waypoint in JavaScript related challenges (except AngularJS, all Ziplines, Git, Node.js and Express.js, MongoDB and Full Stack JavaScript Projects) you can see contents of assert()
functions (in some challenges except()
, assert.equal()
and so on) which are used to test your code. It's part of these challenges that you are able to see the tests that are running against your code."
],
"tests":[
- "assert(editor.getValue().match(/(\\/\\/)...../g), 'Create a \\/\\/
style comment that contains at least five letters');",
- "assert(editor.getValue().match(/(\\/\\*)...../g), 'Create a \/\\* \\*\/
style comment that contains at least five letters.');",
- "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the comment with a \\*\/
');"
+ "assert(editor.getValue().match(/(\\/\\/)...../g), 'Create a //
style comment that contains at least five letters');",
+ "assert(editor.getValue().match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'Create a /* */
style comment that contains at least five letters.');",
+ "assert(editor.getValue().match(/(\\*\\/)/g), 'Make sure that you close the comment with a */
');"
],
"challengeSeed":[
],
@@ -41,7 +42,7 @@
"challengeSeed": [
"function welcomeToBooleans() {",
"",
- "// don't change code above here",
+ "// Only change code below this line.",
"",
" return false;",
"",
@@ -65,7 +66,7 @@
"Look at the ourName
example if you get stuck."
],
"tests": [
- "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');"
+ "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\";",
@@ -75,7 +76,7 @@
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
"",
- "if(typeof(myName) !== \"undefined\"){(function(v){return(v);})(myName);}"
+ "if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}"
],
"type": "waypoint",
"challengeType": 1
@@ -89,11 +90,11 @@
"Now let's create two new string variables: myFirstName
and myLastName
and assign them the values of your first and last name, respectively."
],
"tests": [
- "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');"
+ "assert((function(){if(typeof(myFirstName) !== \"undefined\" && typeof(myFirstName) === \"string\" && myFirstName.length > 0){return true;}else{return false;}})(), 'myFirstName
should be a string with at 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 at least one character in it.');"
],
"challengeSeed": [
- "// name = \"Alan Turing\";",
+ "// var name = \"Alan Turing\";",
"// var firstName = \"Alan\";",
"// var lastName = \"Turing\";",
"",
@@ -101,7 +102,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return(myFirstName + ', ' + myLastName);})();}"
+ "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return myFirstName + ', ' + myLastName;})();}"
],
"type": "waypoint",
"challengeType": 1
@@ -111,13 +112,13 @@
"title": "Check the Length Property of a String Variable",
"difficulty": "9.9809",
"description": [
- "data structures
have properties
. For example, strings
have a property called .length
that will tell you how many characters are in the string.",
+ "Data structures
have properties
. For example, strings
have a property called .length
that will tell you how many characters are in the string.",
"For example, if we created a variable var firstName = \"Charles\"
, we could find out how long the string \"Charles\" is by using the firstName.length
property.",
"Use the .length
property to count the number of characters in the lastName
variable."
],
"tests": [
- "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return(true);}else{return(false);}})(), 'lastNameLength should be equal to eight.');",
- "assert((function(){if(editor.getValue().match(/\\.length/gi) && editor.getValue().match(/\\.length/gi).length >= 2 && editor.getValue().match(/var lastNameLength \\= 0;/gi) && editor.getValue().match(/var lastNameLength \\= 0;/gi).length >= 1){return(true);}else{return(false);}})(), 'You should be getting the length of lastName
by using .length
like this: lastName.length
');"
+ "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'lastNameLength
should be equal to eight.');",
+ "assert((function(){if(editor.getValue().match(/\\.length/gi) && editor.getValue().match(/\\.length/gi).length >= 2 && editor.getValue().match(/var lastNameLength \\= 0;/gi) && editor.getValue().match(/var lastNameLength \\= 0;/gi).length >= 1){return true;}else{return false;}})(), 'You should be getting the length of lastName
by using .length
like this: lastName.length
.');"
],
"challengeSeed": [
"var firstNameLength = 0;",
@@ -128,7 +129,7 @@
"",
"var lastName = \"Lovelace\";",
"",
- "// don't change code above here",
+ "// Only change code below this line.",
"",
"lastNameLength = lastName;",
"",
@@ -137,7 +138,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "if(typeof(lastNameLength) !== \"undefined\"){(function(){return(lastNameLength);})();}"
+ "if(typeof(lastNameLength) !== \"undefined\"){(function(){return lastNameLength;})();}"
],
"type": "waypoint",
"challengeType": 1
@@ -154,7 +155,7 @@
"Try looking at the firstLetterOfFirstName
variable declaration if you get stuck."
],
"tests": [
- "assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && editor.getValue().match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return(true);}else{return(false);}})(), 'The first letter of firstLetterOfLastName should be a L');"
+ "assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && editor.getValue().match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'The first letter of firstLetterOfLastName
should be a \"L\"
.');"
],
"challengeSeed": [
"var firstLetterOfFirstName = \"\";",
@@ -172,7 +173,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(v){return(v);})(firstLetterOfLastName);"
+ "(function(v){return v;})(firstLetterOfLastName);"
],
"type": "waypoint",
"challengeType": 1
@@ -188,7 +189,7 @@
"Try looking at the secondLetterOfFirstName
variable declaration if you get stuck."
],
"tests": [
- "assert(thirdLetterOfLastName === 'v', 'The third last letter of lastName should be a \"v\"');"
+ "assert(thirdLetterOfLastName === 'v', 'The third letter of lastName
should be a \"v\"
.');"
],
"challengeSeed": [
"var firstName = \"Ada\";",
@@ -203,7 +204,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(v){return(v);})(thirdLetterOfLastName);"
+ "(function(v){return v;})(thirdLetterOfLastName);"
],
"type": "waypoint",
"challengeType": 1
@@ -219,8 +220,8 @@
"Try looking at the lastLetterOfFirstName
variable declaration if you get stuck."
],
"tests": [
- "assert(lastLetterOfLastName === \"e\", 'lastLetterOfLastName should be \"e\"');",
- "assert(editor.getValue().match(/\\.length/g), 'You have to use .length
to get the last letter');"
+ "assert(lastLetterOfLastName === \"e\", 'lastLetterOfLastName
should be \"e\"
.');",
+ "assert(editor.getValue().match(/\\.length/g).length === 2, 'You have to use .length
to get the last letter.');"
],
"challengeSeed": [
"var firstName = \"Ada\";",
@@ -235,7 +236,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(v){return(v);})(lastLetterOfLastName);"
+ "(function(v){return v;})(lastLetterOfLastName);"
],
"type": "waypoint",
"challengeType": 1
@@ -248,11 +249,11 @@
"In order to get the last letter of a string, you can subtract one from the string's length.",
"For example, you can get the value of the third-to-last letter of the var firstName = \"Charles\"
string by using firstName[firstName.length - 3]
.",
"Use bracket notation
to find the second-to-last character in the lastName
string.",
- "Try looking at the lastLetterOfLastName
variable declaration if you get stuck."
+ "Try looking at the thirdToLastLetterOfFirstName
variable declaration if you get stuck."
],
"tests": [
- "assert(secondToLastLetterOfLastName === 'c', 'secondToLastLetterOfLastName should be \"c\".');",
- "assert(editor.getValue().match(/\\.length/g), 'You have to use .length to get the third last letter.');"
+ "assert(secondToLastLetterOfLastName === 'c', 'secondToLastLetterOfLastName
should be \"c\"
.');",
+ "assert(editor.getValue().match(/\\.length/g).length === 2, 'You have to use .length to get the second last letter.');"
],
"challengeSeed": [
"var firstName = \"Ada\";",
@@ -267,7 +268,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(v){return(v);})(secondToLastLetterOfLastName);"
+ "(function(v){return v;})(secondToLastLetterOfLastName);"
],
"type": "waypoint",
"challengeType": 1
@@ -282,7 +283,7 @@
"Replace the 0
with the correct number so you can get the result mentioned in the comment."
],
"tests": [
- "assert((function(){if(sum === 20 && editor.getValue().match(/\\+/g)){return(true);}else{return(false);}})(), 'Make the variable sum
equal 20');"
+ "assert((function(){if(sum === 20 && editor.getValue().match(/\\+/g).length >= 2){return true;}else{return false;}})(), 'Make the variable sum
equal 20.');"
],
"challengeSeed": [
"var sum = 10 + 0; //make this equal to 20 by changing the 0 into the appropriate number.",
@@ -290,7 +291,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(z){return('sum='+z);})(sum);"
+ "(function(z){return 'sum='+z;})(sum);"
],
"type": "waypoint",
"challengeType": 1
@@ -301,11 +302,11 @@
"difficulty": "9.98142",
"description": [
"We can also subtract one number from another.",
- "JavaScript uses use the -
symbol for subtraction.",
+ "JavaScript uses the -
symbol for subtraction.",
"Replace the 0
with the correct number so you can get the result mentioned in the comment."
],
"tests": [
- "assert((function(){if(difference === 12 && editor.getValue().match(/\\-/g)){return(true);}else{return(false);}})(), 'Make the variable difference
equal 12');"
+ "assert((function(){if(difference === 12 && editor.getValue().match(/\\-/g)){return true;}else{return false;}})(), 'Make the variable difference
equal 12.');"
],
"challengeSeed": [
"var difference = 45 - 0; //make this equal to 12 by changing the 0 into the appropriate number.",
@@ -313,7 +314,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(z){return('difference='+z);})(difference);"
+ "(function(z){return 'difference='+z;})(difference);"
],
"type": "waypoint",
"challengeType": 1
@@ -324,19 +325,19 @@
"difficulty": "9.98143",
"description": [
"We can also multiply one number by another.",
- "JavaScript uses use the *
symbol for multiplication.",
+ "JavaScript uses the *
symbol for multiplication.",
"Replace the 0
with the correct number so you can get the result mentioned in the comment."
],
"tests": [
- "assert((function(){if(product === 80 && editor.getValue().match(/\\*/g)){return(true);}else{return(false);}})(), 'Make the variable product
equal 80.');"
+ "assert((function(){if(product === 80 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'Make the variable product
equal 80.');"
],
"challengeSeed": [
- "var product = 8 * 0; //make this equal to 80 by changing the 0 into the appropriate number.",
+ "var product = 8 * 0; // Make this equal to 80 by changing the 0 into the appropriate number.",
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(z){return('product='+z);})(product);"
+ "(function(z){return 'product='+z;})(product);"
],
"type": "waypoint",
"challengeType": 1
@@ -347,11 +348,11 @@
"difficulty": "9.9814",
"description": [
"We can also divide one number by another.",
- "JavaScript uses use the /
symbol for division.",
+ "JavaScript uses the /
symbol for division.",
"Replace the 0
with the correct number so you can get the result mentioned in the comment."
],
"tests": [
- "assert((function(){if(quotient === 2 && editor.getValue().match(/\\//g)){return(true);}else{return(false);}})(), 'Make the variable quotient
equal 2.');"
+ "assert((function(){if(quotient === 2 && editor.getValue().match(/var\\s*?quotient\\s*?\\=\\s*?\\d+\\s*?\\/\\s*?\\d+\\s*?;/g)){return true;}else{return false;}})(), 'Make the variable quotient
equal 2.');"
],
"challengeSeed": [
"var quotient = 66 / 0; //make this equal to 2 by changing the 0 into the appropriate number.",
@@ -359,7 +360,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(z){return('quotient='+z);})(quotient);"
+ "(function(z){return 'quotient='+z;})(quotient);"
],
"type": "waypoint",
"challengeType": 1
@@ -373,7 +374,7 @@
"Let's create a variable myDecimal
and give it a decimal value."
],
"tests": [
- "assert((function(){if(typeof(myDecimal) !== \"undefined\" && typeof(myDecimal) === \"number\" && editor.getValue().match(/\\./g).length >=2){return(true);}else{return(false);}})(), 'myDecimal should be a decimal point number.');"
+ "assert((function(){if(typeof(myDecimal) !== \"undefined\" && typeof(myDecimal) === \"number\" && editor.getValue().match(/\\./g).length >=2){return true;}else{return false;}})(), 'myDecimal should be a decimal point number.');"
],
"challengeSeed": [
"// var ourDecimal = 5.7;",
@@ -384,7 +385,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(){if(typeof(myDecimal) !== \"undefined\"){return(myDecimal);}})();"
+ "(function(){if(typeof(myDecimal) !== \"undefined\"){return myDecimal;}})();"
],
"type": "waypoint",
"challengeType": 1
@@ -398,8 +399,8 @@
"Replace the 0.0
with the correct number so that you get the result mentioned in the comments."
],
"tests": [
- "assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return(true);}else{return(false);}})(), 'Make the variable product
equal 5.0.');",
- "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return(true);}else{return(false);}})(), 'Make the variable quotient
equal 2.2.');"
+ "assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'Make the variable product
equal 5.0.');",
+ "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return true;}else{return false;}})(), 'Make the variable quotient
equal 2.2.');"
],
"challengeSeed": [
"var quotient = 4.4 / 2.0; // equals 2.2",
@@ -409,7 +410,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(y){return('product='+y);})(product);"
+ "(function(y){return 'product='+y;})(product);"
],
"type": "waypoint",
"challengeType": 1
@@ -420,26 +421,26 @@
"difficulty": "9.9816",
"description": [
"With JavaScript array
variables, we can store several pieces of data in one place.",
- "You start an array declaration with an opening bracket, end it with a closing bracket, and put a comma between each entry, like this: var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]
.",
- "Now let's create a new array called myArray
that contains both a string
and a number
.",
- "Refer to the comments if you get stuck."
+ "You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this: var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]
.",
+ "Now let's create a new array called myArray
that contains both a string
and a number
(in that order).",
+ "Refer to the commented code in the text editor if you get stuck."
],
"tests": [
- "assert(typeof(myArray) == 'object', 'myArray should be an array');",
- "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The first 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');"
+ "assert(typeof(myArray) == 'object', 'myArray
should be an array
.');",
+ "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'The first 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 array = [\"John\", 23];",
"",
- "var myArray = [];",
"// Only change code below this line.",
"",
+ "var myArray = [];",
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(z){return(z);})(myArray);"
+ "(function(z){return z;})(myArray);"
],
"type": "waypoint",
"challengeType": 1
@@ -449,7 +450,7 @@
"title": "Nest one Array within Another Array",
"difficulty":"9.98161",
"description":[
- "You can also nest arrays within other arrays, like this: [[\"Bulls\", 43]]
.",
+ "You can also nest arrays within other arrays, like this: [[\"Bulls\", 23]]
.",
"Let's now go create a nested array called myArray
."
],
"tests":[
@@ -457,14 +458,14 @@
],
"challengeSeed":[
"var ourArray = [[\"the universe\", \"everything\", 42]];",
- "var myArray = [];",
"// Only change code below this line.",
"",
+ "var myArray = [];",
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}"
+ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}"
],
"type": "waypoint",
"challengeType": 1
@@ -483,11 +484,11 @@
"Create a variable called myData
and set it to equal the first value of myArray
."
],
"tests":[
- "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return(true);}else{return(false);}})(), 'The variable myData
should equal the first value of myArray');"
+ "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'The variable myData
should equal the first value of myArray
.');"
],
"challengeSeed":[
- "//var ourArray = [1,2,3];",
- "//var ourData = ourArray[0]; // equals 1",
+ "// var ourArray = [1,2,3];",
+ "// var ourData = ourArray[0]; // equals 1",
"",
"var myArray = [1,2,3];",
"// Only change code below this line.",
@@ -496,7 +497,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return('myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z));})(myArray, myData);}"
+ "if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}"
],
"type": "waypoint",
"challengeType": 1
@@ -513,8 +514,8 @@
"Now modify the data stored at index 0 of myArray
to the value of 3."
],
"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 >= 1 && editor.getValue().match(/=/g).length >= 2){return(true);}else{return(false);}})(), 'You should be using indexes to modify the values in myArray');"
+ "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(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'You should be using correct index to modify the value in myArray
.');"
],
"challengeSeed":[
"var ourArray = [1,2,3];",
@@ -527,7 +528,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "if(typeof(myArray) !== \"undefined\"){(function(){return(myArray);})();}"
+ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}"
],
"type": "waypoint",
"challengeType": 1
@@ -540,18 +541,18 @@
"Another way to change the data in an array is with the .pop()
function.",
".pop()
is used to \"pop\" a value off of the end of an array. We can retrieve this value by performing pop()
in a variable declaration.",
"Any type of variable can be \"popped\" off of an array.",
- "Use the .pop()
function to remove the last item from myArray."
+ "Use the .pop()
function to remove the last item from myArray
."
],
"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)');"
+ "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), 'removed
should only have the first two values left([\"cat\"], 2).');"
],
"challengeSeed": [
- "//var numbers = [1,2,3];",
- "//console.log(numbers); // logs [1,2,3]",
- "//var removed = numbers.pop();",
- "//console.log(numbers); // logs [1,2]",
- "//console.log(removed); // logs 3",
+ "// var numbers = [1,2,3];",
+ "// console.log(numbers); // logs [1,2,3]",
+ "// var removed = numbers.pop();",
+ "// console.log(numbers); // logs [1,2]",
+ "// console.log(removed); // logs 3",
"",
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"// Only change code below this line.",
@@ -561,7 +562,7 @@
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z));})(myArray, removed);"
+ "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removed = ' + JSON.stringify(z);})(myArray, removed);"
],
"type": "waypoint",
"challengeType": 1
@@ -572,27 +573,27 @@
"difficulty": "9.9818",
"description": [
"Not only can you pop()
data off of the end of an array, you can also push()
data onto the end of an array.",
- "Take the myArray array and push()
this value to the end of it: [\"dog\", 3]
."
+ "Take the myArray
array and push()
this value to the end of it: [\"dog\", 3]
."
],
"tests": [
- "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return(true);}else{return(false);}})(myArray), 'myArray should only have the first two values left([\"John\", 23, [\"dog\", 3]])');"
+ "assert((function(d){if(d[2] != undefined && d[0] == 'John' && d[1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'myArray
should only have the first two values left([\"John\", 23, [\"dog\", 3]]).');"
],
"challengeSeed": [
"var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];",
"ourArray.pop();",
"ourArray.push([\"happy\", \"joy\"]);",
- "// ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]]",
+ "// ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]].",
"",
"var myArray = [\"John\", 23, [\"cat\", 2]];",
"myArray.pop();",
- "//Add a [\"dog\", 3] to the end of myArray using push()",
+ "// Add a [\"dog\", 3] to the end of myArray using push().",
"// Only change code below this line.",
"",
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(z){return('myArray = ' + JSON.stringify(z));})(myArray);"
+ "(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);"
],
"type": "waypoint",
"challengeType": 1
@@ -603,27 +604,27 @@
"difficulty": "9.9817",
"description": [
"pop()
always removes the last element of an array. What if you want to remove the first? That's where .shift()
comes in.",
- "Take the myArray array and shift()
the first value off of it."
+ "Take the myArray
array and shift()
the first value off of it. Set myRemoved
to the first value of myArray
using shift()
."
],
"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' && typeof(myRemoved) === 'string'){return(true);}else{return(false);}})(myRemoved), 'myRemoved should contain \"John\"');"
+ "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 last two values left([23, [\"dog\", 3]]).');",
+ "assert((function(d){if(d === 'John' && typeof(myRemoved) === 'string'){return true;}else{return false;}})(myRemoved), 'myRemoved
should contain \"John\"
.');"
],
"challengeSeed": [
"var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];",
"ourRemoved = ourArray.shift();",
- "// ourArray now equals [\"J\", [\"cat\"]]",
+ "// ourArray now equals [\"J\", [\"cat\"]].",
"",
"var myArray = [\"John\", 23, [\"dog\", 3]];",
"// Only change code below this line.",
"",
- "var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]]",
+ "var myRemoved = myArray; // This should be [\"John\"] and myArray should now be [23, [\"dog\", 3]].",
"",
"// Only change code above this line.",
"",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(y, z){return('myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z));})(myArray, myRemoved);"
+ "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & myRemoved = ' + JSON.stringify(z);})(myArray, myRemoved);"
],
"type": "waypoint",
"challengeType": 1
@@ -633,29 +634,29 @@
"title": "Manipulate 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\"
"
+ "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 start: \"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]])');"
+ "assert((function(d){if(typeof(d[0]) === \"string\" && 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 ourArray = [\"Stimpson\", \"J\", [\"cat\"]];",
"ourArray.shift();",
- "ourArray.unshift([\"happy\", \"joy\"]);",
- "// ourArray now equals [[\"happy\", \"joy\"], \"J\", [\"cat\"]]",
+ "// ourArray now equals [\"happy\", \"J\", [\"cat\"]]",
+ "ourArray.unshift(\"happy\");",
"",
"var myArray = [\"John\", 23, [\"dog\", 3]];",
"myArray.shift();",
"",
- "// Add \"Paul\" to the start of myArray",
+ "// Add \"Paul\" to the start of myArray.",
"// Only change code below this line.",
"",
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
"// You'll learn about functions soon.",
- "(function(y, z){return('myArray = ' + JSON.stringify(y));})(myArray);"
+ "(function(y, z){return 'myArray = ' + JSON.stringify(y);})(myArray);"
],
"type": "waypoint",
"challengeType": 1
@@ -665,28 +666,29 @@
"title": "Write Reusable JavaScript with Functions",
"difficulty":"9.9819",
"description":[
- "In JavaScript, we can divide up our code into reusable parts called functions
.",
+ "In JavaScript, we can divide up our code into reusable parts called functions.",
"Here's an example of a function:",
- "function functionName (a, b) {
",
- " return(a + b);
",
+ "function functionName(a, b) {
",
+ " return a + b;
",
"}
",
- "We can \"call\" our function like this: functionName();
, and it will run and return it's return
value to us.",
- "Create and call a function called myFunction
."
+ "After writing the above lines in our code, we can then pass values to our function and the result following the return
statement will be returned.",
+ "For example, we can pass numbers 4
and 2
by “calling” the function later in our code like this: functionName(4, 2)
.",
+ "In this example, the function will return the number 6
as this is the result of 4 + 2
.",
+ "Create and call a function called myFunction
that returns the sum of a
and b
."
],
"tests":[
- "assert((function(){if(typeof(f) !== \"undefined\" && typeof(f) === \"number\" && f === a + b && editor.getValue().match(/return/gi).length >= 1 && editor.getValue().match(/a/gi).length >= 1 && editor.getValue().match(/b/gi).length >= 1 && editor.getValue().match(/\\+/gi).length >= 1){return(true);}else{return(false);}})(), 'Your function should return the value of a + b');"
+ "assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'Your function should return the value of a + b');"
],
"challengeSeed":[
"var a = 4;",
"var b = 5;",
"",
- "ourFunction = function() {",
+ "function ourFunction(a, b) {",
" return a - b;",
"};",
"",
- "//Don't modify above this line",
- "//Create a function called myFunction that returns the value of a plus b.",
- " // Only change code below this line.",
+ "// Create a function called myFunction that returns the value of a plus b.",
+ "// Only change code below this line.",
"",
"",
"",
@@ -696,7 +698,7 @@
"// You'll learn about functions soon.",
"if(typeof(myFunction) !== \"undefined\"){",
"var f=myFunction(a,b);",
- "(function(){return(f);})();",
+ "(function(){return f;})();",
"}"
],
"type": "waypoint",
@@ -717,24 +719,24 @@
" \"enemies\": [\"Water\", \"Dogs\"]
",
"};
",
"
",
- "Objects are useful for storing data in a structured way, and can represents real world objects, like a cats.",
- "Let's try to make an Object that represents a dog called myDog!"
+ "Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.",
+ "Let's try to make an object that represents a dog called myDog
which contains the properties 'name'
(String), 'legs'
(Number), 'tails'
(Number) and 'friends'
(Array)!"
],
"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');"
+ "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 = {",
+ "// var ourDog = {",
"// \"name\": \"Camper\",",
"// \"legs\": 4,",
"// \"tails\": 1,",
"// \"friends\": [\"everything!\"]",
- "//};",
+ "// };",
"",
- "// add the name(string), legs(number), tails(number) and friends(array) properties to myDog.",
+ "// Add the name (string), legs (number), tails (number) and friends (array) properties to myDog.",
"// You can set them to whatever you want.",
"",
"// Only change code below this line.",
@@ -745,7 +747,7 @@
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
- "(function(z){return(z);})(myDog);"
+ "(function(z){return z;})(myDog);"
],
"type": "waypoint",
"challengeType": 1
@@ -759,12 +761,12 @@
"For example, we can add properties to objects like this:",
"myObject.myProperty = \"myValue\";
",
"We can also delete them like this:",
- "delete(myObject.myProperty);
",
- "Let's add the property \"bark\", and delete the property \"tails\"."
+ "delete myObject.myProperty;
",
+ "Let's add the property \"bark\"
, and delete the property \"tails\"
."
],
"tests":[
- "assert(myDog.bark !== undefined, 'Add the property \"bark\" to myDog.');",
- "assert(myDog.tails === undefined, 'Delete the property \"tails\" from myDog.');"
+ "assert(myDog.bark !== undefined, 'Add the property \"bark\"
to myDog
.');",
+ "assert(myDog.tails === undefined, 'Delete the property \"tails\"
from myDog
.');"
],
"challengeSeed":[
"// var ourDog = {",
@@ -774,8 +776,8 @@
"// \"friends\": [\"everything!\"]",
"// };",
"",
- "// ourDog.bark(\"arf!\");",
- "// delete(ourDog.tails);",
+ "// ourDog.bark = \"arf!\";",
+ "// delete ourDog.tails;",
"",
"var myDog = {",
" \"name\": \"Camper\",",
@@ -794,7 +796,7 @@
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
- "(function(z){return(z);})(myDog);"
+ "(function(z){return z;})(myDog);"
],
"type": "waypoint",
"challengeType": 1
@@ -814,13 +816,24 @@
"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]');"
+ "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":[
+ "ourArray = [];",
+ "for(var i = 0; i < 5; i++){",
+ " ourArray.push(i);",
+ "}",
"var myArray = [];",
- "//Push the numbers zero through four to myArray using a \"for loop\" like above.",
"",
+ "// Only change code below this line.",
+ "",
+ "// Push the numbers zero through four to myArray using a \"for loop\" like above.",
+ "",
+ "// Only change code above this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
+ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}",
""
],
"type": "waypoint",
@@ -839,16 +852,22 @@
" ourArray.push(i);
",
" i++;
",
"}
",
- "Let's try getting a for loop to work by pushing values to an array."
+ "Let's try getting a while 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]');"
+ "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 zero through four to myArray",
+ "// Only change code below this line.",
"",
+ "// Push the numbers zero through four to myArray using a \"while loop\".",
+ "",
+ "// Only change code above this line.",
+ "// We use this function to show you the value of your variable in your output box.",
+ "// You'll learn about functions soon.",
+ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}",
""
],
"type": "waypoint",
@@ -864,22 +883,22 @@
"Use Math.random()
to get 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');"
+ "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()",
+ " // Change the 0 to Math.random().",
" // Only change code below this line.",
"",
- " return(0);",
+ " return 0;",
"",
- "// Only change code above this line.",
+ " // Only change code above this line.",
"}",
"",
"// We use this function to show you the value of your variable in your output box.",
- "(function(){return(myFunction());})();"
+ "(function(){return myFunction();})();"
],
"type": "waypoint",
"challengeType": 1
@@ -889,32 +908,32 @@
"title": "Generate Random Whole Numbers with JavaScript",
"difficulty":"9.9828",
"description":[
- "It's great that we can create random decimal numbers, but it's even more useful if we 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",
+ "It's great that we can create random decimal numbers, but it's even more useful if we use it 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 the nearest less than or equal 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"
+ "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');"
+ "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(editor.getValue().match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || editor.getValue().match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'You should have multiplied the result of Math.random
by 10 to make it a number that\\'s between zero and nine.');",
+ "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 betweenzero and nine> instead of a decimal",
+ " // Make myFunction return a random number between zero and nine instead of a decimal.",
"",
" // Only change code below this line.",
"",
- " return(Math.random());",
+ " return Math.random();",
"",
" // Only change code above this line.",
"}",
"",
"// We use this function to show you the value of your variable in your output box.",
- "(function(){return(myFunction());})();"
+ "(function(){return myFunction();})();"
],
"type": "waypoint",
"challengeType": 1
@@ -926,12 +945,13 @@
"description":[
"We can use a certain mathematical expression to get a random number between two numbers.",
"Math.floor(Math.random() * (max - min + 1)) + min
",
- "By using this we can control the output of a random number."
+ "By using this, we can control the output of a 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 >= 2 && 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');"
+ "assert(myFunction() % 1 === 0 , 'The random number that\\'s generated by myFunction should be an integer');",
+ "assert((function(){if(editor.getValue().match(/max/g).length >= 2 && editor.getValue().match(/min/g).length >= 2 && 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;",
@@ -940,51 +960,52 @@
" // Make myFunction return a random number between zero and nine instead of a decimal",
" // Only change code below this line.",
"",
- " return(Math.random());",
+ " return Math.random();",
"}",
"",
"// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
- "(function(){return(myFunction());})();"
+ "(function(){return myFunction();})();"
],
"type": "waypoint",
"challengeType": 1
},
{
"id":"cf1111c1c12feddfaeb3bdef",
- "title": "Use Conditional Logic with If-Else Statements",
+ "title": "Use Conditional Logic with If and 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 to evaluate.",
- "Example:",
+ "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 to evaluate.",
+ "For example:",
" if (1 === 2) {
",
- " return(true);
",
- "}
",
- "else {
",
- " return(false);
",
+ " return true;
",
+ "} else {
",
+ " return false;
",
"}
",
"Let's use if
and else
statements to make a coin-flip game.",
- "Create an if-else statement
to return heads
if the flip var is zero, or else return tails
if it's not."
+ "Create if
and else
statements to return the string \"heads\"
if the flip variable is zero, or else return the string \"tails\"
if the flip variable is not zero."
],
"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');"
+ "assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'myFunction
should either return heads
or tails
.');",
+ "assert((function(){var result = myFunction();if(result === 'heads' && flip === 0 || result === 'tails' && flip !== 0){return true;} else {return false;}})(), 'myFunction
should return heads
when flip equals 0 and tails
when flip equals 1.');",
+ "assert(editor.getValue().match(/if/g).length >= 4, '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":[
+ "var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;",
"function myFunction(){",
- " var flip = Math.floor(Math.random() * (1 - 0 + 1)) + 0;",
" // Create an if-else statement here to return \"heads\" if flip is 0. Otherwise return \"tails\".",
"",
" // Only change code below this line.",
"",
"",
+ "",
+ " // Only change code above this line.",
"}",
"",
- "// Only change code above this line.",
"// We use this function to show you the value of your variable in your output box.",
- "(function(){return(myFunction());})();"
+ "var result = myFunction();if(typeof(flip) !== \"undefined\" && typeof(flip) === \"number\" && typeof(result) !== \"undefined\" && typeof(result) === \"string\"){(function(y,z){return 'flip = ' + y.toString() + ', text = ' + z;})(flip, result);}"
],
"type": "waypoint",
"challengeType": 1
@@ -995,31 +1016,30 @@
"difficulty":"9.984",
"description":[
"Regular expressions
are used to find certain words or patterns inside of strings
.",
- "For example, if we wanted to find the number of times the word the
occurred in the string The dog chased the cat
, we could use the following regular expression
: \/the+\/gi
",
+ "For example, if we wanted to find the word the
in the string The dog chased the cat
, we could use the following regular expression
: \/the\/gi
",
"Let's break this down a bit:",
"the
is the pattern we want to match.",
- "+
means we want to find one or more occurrences of this pattern.",
- "g
means that we want to search the entire string for this pattern.",
+ "g
means that we want to search the entire string for this pattern instead of just the first match.",
"i
means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.",
- "Regular expressions
are usually surrounded by /
symbols.",
- "Let's try selecting all the occurrences of the word and
in the string George Boole and Alan Turing went to the shop and got some milk
. We can do this by replacing the .+
part of our regular expression with the current regular expression
with the word and
."
+ "Regular expressions
are written by surrounding the pattern with /
symbols.",
+ "Let's try selecting all the occurrences of the word and
in the string Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it
. We can do this by replacing the .
part of our regular expression with the current regular expression
with the word and
."
],
"tests":[
- "assert(test==2, 'Your regular expression
should find two occurrences of the word and
');",
- "assert(editor.getValue().match(/\\/and\\+\\/gi/), 'You should have used regular expressions
to find the word and
');"
+ "assert(test==2, 'Your regular expression
should find two occurrences of the word and
.');",
+ "assert(editor.getValue().match(/\\/and\\/gi/), 'You should have used regular expressions
to find the word and
.');"
],
"challengeSeed":[
"var test = (function() {",
- " var testString = \"George Boole and Alan Turing went to the shop and got some milk\";",
- " var expressionToGetMilk = /milk/gi;",
+ " var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";",
+ " var expressionToGetSoftware = /software/gi;",
" // Only change code below this line.",
"",
- " var expression = /.+/gi;",
+ " var expression = /./gi;",
"",
" // Only change code above this line.",
" // We use this function to show you the value of your variable in your output box.",
- " return(testString.match(expression).length);",
- "})();(function(){return(test);})();"
+ " return testString.match(expression).length;",
+ "})();(function(){return test;})();"
],
"type": "waypoint",
"challengeType": 1
@@ -1031,12 +1051,13 @@
"description":[
"We can use special selectors in Regular Expressions
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
.",
- "Use the \\d
selector to select the number of numbers in the string."
+ "It is used like this: /\\d/g
.",
+ "For numbers this is often written as /\\d+/g
, where the +
following the digit selector allows this regular expression to match multi-digit numbers.",
+ "Use the \\d
selector to select the number of numbers in the string, allowing for the possibility of multi-digit numbers."
],
"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');"
+ "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() {",
@@ -1048,8 +1069,8 @@
"",
" // Only change code above this line.",
" // We use this function to show you the value of your variable in your output box.",
- " return(testString.match(expression).length);",
- "})();(function(){return(test);})();"
+ " return testString.match(expression).length;",
+ "})();(function(){return test;})();"
],
"type": "waypoint",
"challengeType": 1
@@ -1066,7 +1087,7 @@
],
"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
.');"
+ "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(){",
@@ -1078,8 +1099,8 @@
"",
" // Only change code above this line.",
" // We use this function to show you the value of your variable in your output box.",
- " return(testString.match(expression).length);",
- "})();(function(){return(test);})();"
+ " return testString.match(expression).length;",
+ "})();(function(){return test;})();"
],
"type": "waypoint",
"challengeType": 1
@@ -1089,12 +1110,12 @@
"title": "Invert Regular Expression Matches with JavaScript",
"difficulty":"9.987",
"description":[
- "Use /\\S/gi;
to match everything that isn't a space in the string.",
+ "Use /\\S/gi
to match everything that isn't a space in the string.",
"You can invert any match by using the uppercase version of the selector \\s
versus \\S
for example."
],
"tests":[
"assert(test === 49, 'Your RegEx should have found forty nine non-space characters in the testString
.');",
- "assert(editor.getValue().match(/\\/\\\\S\\/gi/gi), 'You should be using the following expression /\\S/gi
to find non-space characters in the testString
.');"
+ "assert(editor.getValue().match(/\\/\\\\S\\/gi/gi), 'You should be using the following expression /\\\\S/gi
to find non-space characters in the testString
.');"
],
"challengeSeed":[
"var test = (function(){",
@@ -1106,8 +1127,8 @@
"",
" // Only change code above this line.",
" // We use this function to show you the value of your variable in your output box.",
- " return(testString.match(expression).length);",
- "})();(function(){return(test);})();"
+ " return testString.match(expression).length;",
+ "})();(function(){return test;})();"
],
"type": "waypoint",
"challengeType":1
@@ -1120,14 +1141,14 @@
"We are now going to try and combine some of the stuff we've just learned and create the logic for a slot machine game.",
"For this we will need to generate three random numbers between 1
and 3
to represent the possible values of each individual slot.",
"Store the three random numbers in slotOne
, slotTwo
and slotThree
.",
- "Generate the random numbers by using the system we used earlier:",
+ "Generate the random numbers by using the system we used earlier (an explanation of the formula can be found here):",
"Math.floor(Math.random() * (3 - 1 + 1)) + 1;
"
],
"tests":[
"assert(typeof(runSlots($(\".slot\"))[0]) === \"number\", 'slotOne
should be a random number.')",
"assert(typeof(runSlots($(\".slot\"))[1]) === \"number\", 'slotTwo
should be a random number.')",
"assert(typeof(runSlots($(\".slot\"))[2]) === \"number\", 'slotThree
should be a random number.')",
- "assert((function(){if(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi) !== null){return(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi).length >= 3);}else{return(false);}})(), 'You should have used Math.floor(Math.random() * (3 - 1 + 1)) + 1;
three times to generate your random numbers.')"
+ "assert((function(){if(editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi) !== null){return editor.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1;/gi).length >= 3;}else{return false;}})(), 'You should have used Math.floor(Math.random() * (3 - 1 + 1)) + 1;
three times to generate your random numbers.')"
],
"challengeSeed":[
"fccss",
@@ -1150,7 +1171,7 @@
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $(\".logger\").html(slotOne + \" \" + slotTwo + \" \" + slotThree);",
" }",
- " return([slotOne, slotTwo, slotThree]);",
+ " return [slotOne, slotTwo, slotThree];",
" }",
"",
" $(document).ready(function(){",
@@ -1274,14 +1295,14 @@
"Now that our slots will each generate random numbers, we need to check whether they've all returned the same number.",
"If they have, we should notify our user that they've won.",
"Otherwise, we should return null
, which is a JavaScript data structure that means nothing.",
- "If all three numbers match, we should change the value of win to the number that we have three of or leave it as null.",
+ "If all three numbers match, we should return the number that we have in three of slots or leave it as null
.",
"Let's create an if statement
with multiple conditions in order to check whether all numbers are equal.",
"if(slotOne !== slotTwo || slotTwo !== slotThree){
",
- " return(null);
",
+ " return null;
",
"}
"
],
"tests":[
- "assert((function(){var data = runSlots();if(data === null){return(true)}else{if(data[0] === data[1] && data[1] === data[2]){return(true);}else{return(false);}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.')"
+ "assert((function(){var data = runSlots();if(data === null){return true}else{if(data[0] === data[1] && data[1] === data[2]){return true;}else{return false;}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null
.')"
],
"challengeSeed":[
"fccss",
@@ -1310,7 +1331,7 @@
" $(\".logger\").append(\" \" + slotTwo);",
" $(\".logger\").append(\" \" + slotThree);",
" }",
- " return([slotOne, slotTwo, slotThree]);",
+ " return [slotOne, slotTwo, slotThree];",
" }",
"",
" $(document).ready(function(){",
@@ -1439,8 +1460,8 @@
"Use the above selector to display each number in its corresponding slot."
],
"tests":[
- "assert((function(){runSlots();if($($(\".slot\")[0]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[1]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[2]).html().replace(/\\s/gi, \"\") !== \"\"){return(true);}else{return(false);}})(), 'You should be displaying the result of the slot numbers in the corresponding slots')",
- "assert((function(){if(editor.match( /\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)/gi )){if(editor.match( /\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\)/gi ) && editor.match( /\\.html\\(slotTwo\\)/gi ) && editor.match( /\\.html\\(slotThree\\)/gi )){return(true);}else{return(false);}}else{return(false);}})(), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne, slotTwo and slotThree respectively')"
+ "assert((function(){runSlots();if($($(\".slot\")[0]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[1]).html().replace(/\\s/gi, \"\") !== \"\" && $($(\".slot\")[2]).html().replace(/\\s/gi, \"\") !== \"\"){return true;}else{return false;}})(), 'You should be displaying the result of the slot numbers in the corresponding slots.')",
+ "assert((editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi) && editor.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\)/gi ) && editor.match( /\\.html\\(slotTwo\\)/gi ) && editor.match( /\\.html\\(slotThree\\)/gi )), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne
, slotTwo
and slotThree
respectively.')"
],
"challengeSeed":[
"fccss",
@@ -1465,7 +1486,7 @@
" // Only change code above this line.",
" ",
" if(slotOne !== slotTwo || slotTwo !== slotThree){",
- " return(null);",
+ " return null;",
" }",
" ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
@@ -1474,7 +1495,7 @@
" $(\".logger\").append(\" \" + slotThree);",
" }",
" ",
- " return([slotOne, slotTwo, slotThree]);",
+ " return [slotOne, slotTwo, slotThree];",
" }",
"",
" $(document).ready(function(){",
@@ -1604,10 +1625,13 @@
"Set up all three slots like this, then click the \"Go\" button to play the slot machine."
],
"tests":[
- "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\
\\'\\);/gi) && editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\
\\'\\);/gi).length >= 3, 'Use the provided code three times. One for each slot')",
- "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne value at least once')",
- "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the slotTwo value at least once')",
- "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once')"
+ "assert((editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\
\\'\\s*?\\);/gi) && editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\
\\'\\s*?\\);/gi).length >= 3), 'Use the provided code three times. One for each slot.')",
+ "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[0\\]\\s*?\\)/gi), 'You should have used $('.slot')[0]
at least once.')",
+ "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[1\\]\\s*?\\)/gi), 'You should have used $('.slot')[1]
at least once.')",
+ "assert(editor.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[2\\]\\s*?\\)/gi), 'You should have used $('.slot')[2]
at least once.')",
+ "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne
value at least once.')",
+ "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the slotTwo
value at least once.')",
+ "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree
value at least once.')"
],
"challengeSeed":[
"fccss",
@@ -1632,7 +1656,7 @@
" // Only change code above this line.",
" ",
" if(slotOne !== slotTwo || slotTwo !== slotThree){",
- " return(null);",
+ " return null;",
" }",
" ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
@@ -1641,7 +1665,7 @@
" $('.logger').append(' ' + slotThree);",
" }",
" ",
- " return([slotOne, slotTwo, slotThree]);",
+ " return [slotOne, slotTwo, slotThree];",
" }",
"",
" $(document).ready(function(){",
diff --git a/seed/challenges/basic-ziplines.json b/seed/challenges/basic-ziplines.json
index 37e547c4e3..113d9e7de5 100644
--- a/seed/challenges/basic-ziplines.json
+++ b/seed/challenges/basic-ziplines.json
@@ -16,7 +16,8 @@
"Drag the windows around and press the buttons in the lower-right hand corner to change the orientation to suit your preference.",
"Click the gear next to CSS. Then under the \"Add External CSS\" section, use the \"Quick-add\" select box to select Bootstrap. Then click \"Save & Close\".",
"Verify that bootstrap is active by adding the following code to your HTML: <h1 class='text-primary'>Hello CodePen!</h1>
. The text's color should be Bootstrap blue.",
- "Click the gear next to JavaScript. Click the \"Quick-add\" select box and choose jQuery (not jQuery UI). Then click \"Save & Close\".",
+ "Click the gear next to JavaScript. Click the \"Quick-add\" select box and choose jQuery (not jQuery UI).",
+ "Click the \"Quick-add\" select box again and choose Bootstrap. Then click \"Save & Close\".",
"Now add the following code to your JavaScript: $(document).ready(function() { $('.text-primary').text('Hi CodePen!') });
. Click the \"Save\" button at the top. Your \"Hello CodePen!\" should change to \"Hi CodePen!\". This means that jQuery is working.",
"You can use this CodePen that you've just created as a starting point for your Ziplines. Just click the \"fork\" button at the top of your CodePen and it will create a duplicate CodePen.",
"Now you're ready for your first Zipline. Click the \"I've completed this challenge\" button."
@@ -28,8 +29,22 @@
"descriptionCn": [],
"nameFr": "",
"descriptionFr": [],
- "nameRu": "",
- "descriptionRu": [],
+ "nameRu": "Приготовьтесь к Zipline'ам",
+ "descriptionRu": [
+ "Теперь вы готовы приступить к Zipline'ам. Это задания по фронт-энд разработке, в них вы примените ранее изученные HTML, CSS, jQuery и JavaScript и создадите статические (не использующие базу данных) приложения.",
+ "Ни в коем случае не унывайте! Воспользуйтесь Read-Search-Ask, если что-то не получается.",
+ "Задания мы будем выполнять используя CodePen - популярный инструмент для создания и обмена статическими веб приложениями.",
+ "Перейдите по ссылке http://codepen.io и создайте аккаунт.",
+ "Нажмите на ваш аватар в правом верхнем углу, а затем в открывшемся меню на кнопку \"New pen\".",
+ "Выберите удобное расположение окон с помощью кнопок в правом нижнем углу, отрегулируйте их ширину.",
+ "Нажмите на звездочку рядом с CSS. Затем в секции \"Add External CSS\" выберите \"Quick-add\" и добавьте Bootstrap. Нажмите \"Save & Close\".",
+ "Проверьте, что Bootstrap подключен добавив следующий HTML код: <h1 class='text-primary'>Hello CodePen!</h1>
. Цвет текста должен быть синим.",
+ "Нажмите на звездочку рядом с JavaScript. Нажмите \"Quick-add\" и выберите jQuery (не jQuery UI). Нажмите \"Save & Close\".",
+ "Снова нажмите на поле \"Quick-add\", выберите Bootstrap и затем нажмите \"Save & Close\".",
+ "Теперь добавьте следующий код в окошко JavaScript: $(document).ready(function() { $('.text-primary').text('Hi CodePen!') });
. Нажмите на кнопку \"Save\" расположенную наверху. Текст \"Hello CodePen!\" должен измениться на \"Hi CodePen!\". Это значит что jQuery работает.",
+ "CodePen, который мы создали, можно использовать в качестве отправной точки для ваших Zipline'ов. Кликните кнопку \"fork\", чтобы создать копию текущего CodePen'a.",
+ "Все готово для первого Zipline'а. Жмите кнопку \"I've completed this challenge\"."
+ ],
"nameEs": "",
"descriptionEs": [],
"namePt": "",
@@ -45,6 +60,7 @@
"Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.",
"Rule #2: You may use whichever libraries or APIs you need.",
"Rule #3: Reverse engineer the example project's functionality, and also feel free to personalize it.",
+ "Hint: If you don't want to start from scratch, you can fork this simple Bootstrap portfolio template on CodePen: http://codepen.io/FreeCodeCamp/pen/mJNqQj.",
"Here are the user stories you must enable, and optional bonus user stories:",
"User Story: As a user, I can access all of the portfolio webpage's content just by scrolling.",
"User Story: As a user, I can click different buttons that will take me to the portfolio creator's different social media pages.",
@@ -55,7 +71,7 @@
"Note that CodePen.io overrides the Window.open() function, so if you want to open windows using jquery, you will need to target invisible anchor elements like this one: <a target='_blank'>
.",
"Remember to use Read-Search-Ask if you get stuck.",
"When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen. If you pair programmed, you should also include the Free Code Camp username of your pair.",
- "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.
Click here then add your link to your tweet's text"
+ "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.
Click here then add your link to your tweet's text"
],
"type": "zipline",
"challengeType": 3,
@@ -64,8 +80,25 @@
"descriptionCn": [],
"nameFr": "",
"descriptionFr": [],
- "nameRu": "",
- "descriptionRu": [],
+ "nameRu": "Создайте сайт-портфолио",
+ "descriptionRu": [
+ "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/ThiagoFerreir4/full/eNMxEp.",
+ "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.",
+ "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.",
+ "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.",
+ "Подсказка: Если вы не хотите создавать портфолио с нуля, можете взять за основу этот простой Bootstrap шаблон: http://codepen.io/FreeCodeCamp/pen/mJNqQj.",
+ "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:",
+ "Пользовательская история: В качестве пользователя, я могу получить доступ ко всей информации на странице просто прокрутив ее сверху вниз.",
+ "Пользовательская история: В качестве пользователя, я могу нажать на различные кнопки и перейти к социальным страницам владельца портфолио.",
+ "Пользовательская история: В качестве пользователя, я могу увидеть эскизы проектов, которые были созданы владельцем портфолио (используйте временную картинку если у вас пока нету собственных веб-страниц).",
+ "Бонусная пользовательская история: В качестве пользователя, я могу перемещаться к различным частям страницы нажимая на соответствующие навигационные кнопки.",
+ "Не переживайте если вам пока нечего показать в портфолио - вы создадите несколько веб приложений в следующих заданиях, а затем вернетесь и обновите портфолио.",
+ "В сети существует много шаблонов для портфолио, но в этом задании вам необходимо создать собственную уникальную страницу. Использование Bootstrap сделает этот процесс намного проще.",
+ "Обратите внимание, что CodePen.io переопределяет функцию Window.open(), поэтому, если вы хотите открывать окна используя jQuery, необходимо будет адресовать невидимые якорные элементы, такие как этот: <a target='_blank'&rt;
.",
+ "Если что-то не получается, воспользуйтесь Read-Search-Ask.",
+ "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.",
+ "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.
Click here then add your link to your tweet's text"
+ ],
"nameEs": "",
"descriptionEs": [],
"namePt": "",
@@ -87,7 +120,7 @@
"Note that you can either put your quotes into an array and show them at random, or use an API to get quotes, such as http://forismatic.com/en/api/.",
"Remember to use Read-Search-Ask if you get stuck.",
"When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen. If you pair programmed, you should also include the Free Code Camp username of your pair.",
- "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.
Click here then add your link to your tweet's text"
+ "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.
Click here then add your link to your tweet's text"
],
"type": "zipline",
"challengeType": 3,
@@ -96,8 +129,20 @@
"descriptionCn": [],
"nameFr": "",
"descriptionFr": [],
- "nameRu": "",
- "descriptionRu": [],
+ "nameRu": "Создайте генератор случайных цитат",
+ "descriptionRu": [
+ "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/AdventureBear/full/vEoVMw.",
+ "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.",
+ "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.",
+ "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.",
+ "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:",
+ "Пользовательская история: В качестве пользователя, я могу нажать на кнопку и получить случайную цитату.",
+ "Бонусная пользовательская история: В качестве пользователя, я могу нажать на кнопку и опубликовать цитату в Twitter'e.",
+ "Цитаты можно добавить в массив и случайным образом выводить одну из них, либо можно воспользоваться соответствующим API, например http://forismatic.com/en/api/.",
+ "Если что-то не получается, воспользуйтесь Read-Search-Ask.",
+ "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.",
+ "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.
Click here then add your link to your tweet's text"
+ ],
"nameEs": "",
"descriptionEs": [],
"namePt": "",
@@ -115,12 +160,12 @@
"Rule #3: Reverse engineer the example project's functionality, and also feel free to personalize it.",
"Here are the user stories you must enable, and optional bonus user stories:",
"User Story: As a user, I can see the weather in my current location.",
- "Bonus User Story: As a user, I can see an icon depending on the temperature..",
- "Bonus User Story: As a user, I see a different background image depending on the temperature (e.g. snowy mountain, hot desert).",
+ "Bonus User Story: As a user, I can see an icon depending on the weather.",
+ "Bonus User Story: As a user, I see a different background image (e.g. snowy mountain, hot desert) depending on the weather.",
"Bonus User Story: As a user, I can push a button to toggle between Fahrenheit and Celsius.",
"Remember to use Read-Search-Ask if you get stuck.",
"When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen. If you pair programmed, you should also include the Free Code Camp username of your pair.",
- "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.
Click here then add your link to your tweet's text"
+ "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.
Click here then add your link to your tweet's text"
],
"type": "zipline",
"challengeType": 3,
@@ -129,8 +174,21 @@
"descriptionCn": [],
"nameFr": "",
"descriptionFr": [],
- "nameRu": "",
- "descriptionRu": [],
+ "nameRu": "Покажите местную погоду",
+ "descriptionRu": [
+ "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/AdventureBear/full/yNBJRj.",
+ "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.",
+ "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.",
+ "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.",
+ "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:",
+ "Пользовательская история: В качестве пользователя, я могу узнать погоду с учетом моего текущего местоположения.",
+ "Бонусная пользовательская история: В качестве пользователя, я могу в зависимости от погоды видеть различные температурные значки.",
+ "Бонусная пользовательская история: В качестве пользователя, я могу в зависимости от погоды видеть различные фоновые изображения (снежные горы, знойная пустыня).",
+ "Бонусная пользовательская история: В качестве пользователя, я могу нажать на кнопку чтобы переключится между градусами по Цельсию или по Фаренгейту.",
+ "Если что-то не получается, воспользуйтесь Read-Search-Ask.",
+ "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.",
+ "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.
Click here then add your link to your tweet's text"
+ ],
"nameEs": "",
"descriptionEs": [],
"namePt": "",
@@ -152,7 +210,7 @@
"Bonus User Story: As a user, I can customize the length of each pomodoro.",
"Remember to use Read-Search-Ask if you get stuck.",
"When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen. If you pair programmed, you should also include the Free Code Camp username of your pair.",
- "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.
Click here then add your link to your tweet's text"
+ "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.
Click here then add your link to your tweet's text"
],
"type": "zipline",
"challengeType": 3,
@@ -161,8 +219,20 @@
"descriptionCn": [],
"nameFr": "",
"descriptionFr": [],
- "nameRu": "",
- "descriptionRu": [],
+ "nameRu": "Создайте таймер Pomodoro",
+ "descriptionRu": [
+ "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/GeoffStorbeck/full/RPbGxZ/.",
+ "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.",
+ "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.",
+ "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.",
+ "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:",
+ "Пользовательская история: В качестве пользователя, я могу запустить 25 минутную 'помидорку', по истечении которой таймер выключится.",
+ "Бонусная пользовательская история: В качестве пользователя, я могу сбросить таймер для установки следующей 'помидорки'.",
+ "Бонусная пользовательская история: В качестве пользователя, я могу выбирать длительность 'помидорки'.",
+ "Если что-то не получается, воспользуйтесь Read-Search-Ask.",
+ "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.",
+ "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.
Click here then add your link to your tweet's text"
+ ],
"nameEs": "",
"descriptionEs": [],
"namePt": "",
@@ -189,7 +259,7 @@
"Hint: Here's an array of the Twitch.tv usernames of people who regularly stream coding: [\"freecodecamp\", \"storbeck\", \"terakilobyte\", \"habathcx\",\"RobotCaleb\",\"thomasballinger\",\"noobs2ninjas\",\"beohoff\"]
",
"Remember to use Read-Search-Ask if you get stuck.",
"When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen. If you pair programmed, you should also include the Free Code Camp username of your pair.",
- "If you'd like immediate feedback on your project, click this button and paste in a link to your CodePen project. Otherwise, we'll review it before you start your nonprofit projects.
Click here then add your link to your tweet's text"
+ "If you'd like immediate feedback on your project from fellow campers, click this button and paste in a link to your CodePen project.
Click here then add your link to your tweet's text"
],
"type": "zipline",
"challengeType": 3,
@@ -198,8 +268,25 @@
"descriptionCn": [],
"nameFr": "",
"descriptionFr": [],
- "nameRu": "",
- "descriptionRu": [],
+ "nameRu": "Используйте Twitch.tv JSON API",
+ "descriptionRu": [
+ "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/GeoffStorbeck/full/GJKRxZ.",
+ "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.",
+ "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.",
+ "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.",
+ "Реализуйте следующие пользовательские истории, сделайте также бонусные по желанию:",
+ "Пользовательская история: В качестве пользователя, я могу увидеть идет ли в данный момент на Twitch.tv трансляция Free Code Camp.",
+ "Пользовательская история: В качестве пользователя, я могу, кликнув на описание трансляции, перейти на канал Free Code Camp.",
+ "Пользовательская история: В качестве пользователя, я могу видеть дополнительную информацию о текущей трансляции Free Code Camp.",
+ "Бонусная пользовательская история: В качестве пользователя, я могу произвести поиск среди перечисленных каналов.",
+ "Бонусная пользовательская история: В качестве пользователя, я могу видеть уведомление, если создатель канала закрыл свой аккаунт на Twitch.tv. Добавьте в массив имена пользователей brunofin и comster404, чтобы убедиться, что эта функция реализована правильно.",
+ "Подсказка: Пример запроса к Twitch.tv JSON API: https://api.twitch.tv/kraken/streams/freecodecamp
.",
+ "Подсказка: Документацию об этом запросе можно найти по ссылке: https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streamschannel.",
+ "Подсказка: В этом массиве приведены имена пользователей, которые регулярно пишут код онлайн: [\"freecodecamp\", \"storbeck\", \"terakilobyte\", \"habathcx\",\"RobotCaleb\",\"comster404\",\"brunofin\",\"thomasballinger\",\"noobs2ninjas\",\"beohoff\"]
",
+ "Если что-то не получается, воспользуйтесь Read-Search-Ask.",
+ "Когда выполните задание кликните кнопку \"I've completed this challenge\" и добавьте ссылку на ваш CodePen. Если вы программировали с кем-то в паре, также добавьте имя вашего напарника.",
+ "Если вы хотите получить немедленную оценку вашего проекта, нажмите эту кнопку и добавьте ссылку на ваш CodePen. В противном случае мы проверим его перед тем как вы приступите к проектам для некоммерческих организаций.
Click here then add your link to your tweet's text"
+ ],
"nameEs": "",
"descriptionEs": [],
"namePt": "",
diff --git a/seed/challenges/bootstrap.json b/seed/challenges/bootstrap.json
index da7a510236..fb4f864474 100644
--- a/seed/challenges/bootstrap.json
+++ b/seed/challenges/bootstrap.json
@@ -91,7 +91,7 @@
"title": "Make Images Mobile Responsive",
"difficulty": 2.02,
"description": [
- "First, Add a new image below the existing one. Set it's src
attribute to http://bit.ly/fcc-running-cats
.",
+ "First, add a new image below the existing one. Set it's src
attribute to http://bit.ly/fcc-running-cats
.",
"It would be great if this image could be exactly the width of our phone's screen.",
"Fortunately, with Bootstrap, all we need to do is add the img-responsive
class to your image. Do this, and the image should perfectly fit the width of your page."
],
@@ -176,8 +176,8 @@
"title": "Center Text with Bootstrap",
"difficulty": 2.03,
"description": [
- "Now that we're using Bootstrap, we can center our heading elements to make them look better. All we need to do is add the class text-center
to our h1
and h2
elements.",
- "Remember that you can add several classes to the same element by separating each of them with a space, like this: <h2 class=\"text-red text-center\">your text</h2>
."
+ "Now that we're using Bootstrap, we can center our heading element to make it look better. All we need to do is add the class text-center
to our h2
element.",
+ "Remember that you can add several classes to the same element by separating each of them with a space, like this: <h2 class=\"red-text text-center\">your text</h2>
."
],
"tests": [
"assert($(\"h2\").hasClass(\"text-center\"), 'Your h2
element should be centered by applying the class text-center
')"
@@ -347,7 +347,7 @@
"description": [
"Normally, your button
elements are only as wide as the text that they contain. By making them block elements, your button will stretch to fill your page's entire horizontal space.",
"This image illustrates the difference between inline
elements and block-level
elements:",
- "
",
+ "
",
"Note that these buttons still need the btn
class.",
"Add Bootstrap's btn-block
class to your Bootstrap button."
],
@@ -614,7 +614,7 @@
"Note that these buttons still need the btn
and btn-block
classes."
],
"tests": [
- "assert(new RegExp(\"delete\",\"gi\").test($(\"button\").text()), 'Create a new button
element with the text \"delete\".')",
+ "assert(new RegExp(\"Delete\",\"gi\").test($(\"button\").text()), 'Create a new button
element with the text \"Delete\".')",
"assert($(\"button.btn-block.btn\").length > 2, 'All of your Bootstrap buttons should have the btn
and btn-block
classes.')",
"assert($(\"button\").hasClass(\"btn-danger\"), 'Your new button should have the class btn-danger
.')",
"assert(editor.match(/<\\/button>/g) && editor.match(/
elements have a closing tag.')"
@@ -700,7 +700,7 @@
"description": [
"Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div
element.",
"Here's a diagram of how Bootstrap's 12-column grid layout works:",
- "col-md-*
class is being used. Here, md
means medium, and *
is a number specifying how many columns wide the element should be. In this case, the column width of an element on a medium-sized screen, such as a laptop, is being specified.",
"In the Cat Photo App that we're building, we'll use col-xs-*
, where xs
means extra small (like an extra-small mobile phone screen), and *
is the number of columns specifying how many columns wide the element should be.",
"Put the Like
, Info
and Delete
buttons side-by-side by nesting all three of them within one <div class=\"row\">
element, then each of them within a <div class=\"col-xs-4\">
element.",
@@ -893,9 +893,9 @@
"title": "Use Spans for Inline Elements",
"difficulty": 2.105,
"description": [
- "You can use use spans to create inline elements. Remember when we used the btn-block
class to make the button grow fill the entire row?",
+ "You can use spans to create inline elements. Remember when we used the btn-block
class to make the button fill the entire row?",
"This image illustrates the difference between inline
elements and block-level
elements:",
- "span
element, you can put several elements together, and even style different parts of the same element differently.",
"Nest the word \"love\" in your \"Things cats love\" element below within a span
element. Then give that span
the class text-danger
to make the text red.",
"Here's how you would do this with the \"Top 3 things cats hate\" element: <p>Top 3 things cats <span class = \"text-danger\">hate</span></p>
"
@@ -909,19 +909,11 @@
"challengeSeed": [
"",
"",
"",
"Click here for cat photos.
", - "", - "div
element.",
"Here's a diagram of how Bootstrap's 12-column grid layout works:",
- "col-md-*
class is being used. Here, md
means medium, and *
is a number specifying how many columns wide the element should be. In this case, the column width of an element on a medium-sized screen, such as a laptop, is being specified.",
"In the Cat Photo App that we're building, we'll use col-xs-*
, where xs
means extra small (like an extra-small mobile phone screen), and *
is the number of columns specifying how many columns wide the element should be.",
"Nest your first image and your h2
element within a single <div class=\"row\">
element. Nest your h2
text within a <div class=\"col-xs-8\">
and your image in a <div class=\"col-xs-4\">
so that they are on the same line.",
@@ -1172,9 +1159,9 @@
"Use Font Awesome to add a info-circle
icon to your info button and a trash
icon to your delete button."
],
"tests": [
- "assert($(\"i\").hasClass(\"fa fa-trash\"), 'You should add a <i class=\"fa fa-trash\"></i>
within your delete button element.')",
- "assert($(\"i\").hasClass(\"fa fa-info-circle\"), 'You should add a <i class=\"fa fa-info-circle\"></i>
within your info button element.')",
- "assert(editor.match(/<\\/i>/g) && editor.match(/<\\/i/g).length > 2, 'Make sure each of your i
elements has a closing tag.')"
+ "assert($(\".btn-danger > i\").hasClass(\"fa fa-trash\"), 'You should add a <i class=\"fa fa-trash\"></i>
within your delete button element.')",
+ "assert($(\".btn-info > i\").hasClass(\"fa fa-info-circle\"), 'You should add a <i class=\"fa fa-info-circle\"></i>
within your info button element.')",
+ "assert(editor.match(/<\\/i>/g) && editor.match(/<\\/i>/g).length > 2 && $(\".btn-primary > i\").hasClass(\"fa fa-thumbs-up\"), 'Make sure each of your i
elements has a closing tag and <i class=\"fa fa-thumbs-up\"></i>
is in your like button element.')"
],
"challengeSeed": [
"",
@@ -1532,7 +1519,7 @@
"difficulty": 2.17,
"description": [
"Now let's get your form input
and your submission button
on the same line. We'll do this the same way we have previously: by using a div
element with the class row
, and other div
elements within it using the col-xs-*
class.",
- "Nest both your form's text input
and submit button
within a div
with the class row
. Nest your form's text input
within a div with the class of \"col-xs-7\". Nest your form's submit button
in a div
with the class col-xs-5
.",
+ "Nest both your form's text input
and submit button
within a div
with the class row
. Nest your form's text input
within a div with the class of col-xs-7
. Nest your form's submit button
in a div
with the class col-xs-5
.",
"This is the last challenge we'll do for our Cat Photo App for now. We hope you've enjoyed learning Font Awesome, Bootstrap, and responsive design!"
],
"tests": [
@@ -1735,7 +1722,7 @@
"Create two div
elements within your row, both with the class col-xs-6
."
],
"tests": [
- "assert($(\"div.row\").children(\"div.col-xs-6\").length > 1, 'Nest two div class=\"col-xs-6\"
elements within your div class=\"row\"
element.')",
+ "assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest two div class=\"col-xs-6\"
elements within your div class=\"row\"
element.')",
"assert(editor.match(/<\\/div>/g) && editor.match(/div
element with the class well
within each of your col-xs-6
div
elements."
],
"tests": [
- "assert($(\"div\").length > 4, 'Add two div
elements inside your div class=\"well\">
element both with the class col-xs-6
')",
- "assert($(\"div.col-xs-6\").children(\"div.well\").length > 1, 'Nest both of your div class=\"col-xs-6\"
elements within your div class=\"row\"
element.')",
+ "assert($(\"div.col-xs-6\").not(\":has(>div.well)\").length < 1, 'Add a div
element with the class well
inside each of your div
elements with the class \"col-xs-6\"
')",
+ "assert($(\"div.row > div.col-xs-6\").length > 1, 'Nest both of your div
elements with the class \"col-xs-6\"
within your div
element with the class \"row\"
.')",
"assert(editor.match(/<\\/div>/g) && editor.match(/left-well
. Give the well on the right the id
of right-well
."
],
"tests": [
- "assert($(\"#left-well\") && $(\"#left-well\").length > 0, 'Give your left well
the id of left-well
.')",
- "assert($(\"#right-well\") && $(\"#right-well\").length > 0, 'Give your right well
the id of right-well
.')"
+ "assert($(\".col-xs-6\").children(\"#left-well\") && $(\".col-xs-6\").children(\"#left-well\").length > 0, 'Give your left well
the id of left-well
.')",
+ "assert($(\".col-xs-6\").children(\"#right-well\") && $(\".col-xs-6\").children(\"#right-well\").length > 0, 'Give your right well
the id of right-well
.')"
],
"challengeSeed": [
"col-xs-6
div
element, add a h4
element with the text #right-well
."
],
"tests": [
- "assert($(\".col-xs-6\").children(\"h4\") && $(\".col-xs-6\").children(\"h4\").length > 1, 'Add an h4
element to each of your <div class=\\\"col-xs-6\\\">
elements.');",
+ "assert($(\".col-xs-6\").children(\"h4\") && $(\".col-xs-6\").children(\"h4\").length > 1, 'Add an h4
element to each of your <div class=\"col-xs-6\">
elements.');",
"assert(new RegExp(\"#left-well\",\"gi\").test($(\"h4\").text()), 'One h4
element should have the text #left-well
.');",
"assert(new RegExp(\"#right-well\",\"gi\").test($(\"h4\").text()), 'One h4
element should have the text #right-well
.');",
"assert(editor.match(/<\\/h4>/g) && editor.match(/target1
and ending with target6
."
],
"tests": [
- "assert($(\"#target1\") && $(\"#target1\").length > 0, 'One button
element should have the id target1
.')",
- "assert($(\"#target2\") && $(\"#target2\").length > 0, 'One button
element should have the id target2
.')",
- "assert($(\"#target3\") && $(\"#target3\").length > 0, 'One button
element should have the id target3
.')",
- "assert($(\"#target4\") && $(\"#target4\").length > 0, 'One button
element should have the id target4
.')",
- "assert($(\"#target5\") && $(\"#target5\").length > 0, 'One button
element should have the id target5
.')",
- "assert($(\"#target6\") && $(\"#target6\").length > 0, 'One button
element should have the id target6
.')"
+ "assert($(\"#left-well\").children(\"#target1\") && $(\"#left-well\").children(\"#target1\").length > 0, 'One button
element should have the id target1
.')",
+ "assert($(\"#left-well\").children(\"#target2\") && $(\"#left-well\").children(\"#target2\").length > 0, 'One button
element should have the id target2
.')",
+ "assert($(\"#left-well\").children(\"#target3\") && $(\"#left-well\").children(\"#target3\").length > 0, 'One button
element should have the id target3
.')",
+ "assert($(\"#right-well\").children(\"#target4\") && $(\"#right-well\").children(\"#target4\").length > 0, 'One button
element should have the id target4
.')",
+ "assert($(\"#right-well\").children(\"#target5\") && $(\"#right-well\").children(\"#target5\").length > 0, 'One button
element should have the id target5
.')",
+ "assert($(\"#right-well\").children(\"#target6\") && $(\"#right-well\").children(\"#target6\").length > 0, 'One button
element should have the id target6
.')"
],
"challengeSeed": [
"how-to-npm
with this command: npm install -g git-it
",
+ "Click the \"Create workspace\" button.",
+ "Once C9 builds and loads your workspace, you should see a terminal window in the lower right hand corner. In this window use the following commands. You don't need to know what these mean at this point.",
+ "Install git-it
with this command: npm install -g git-it
",
"Now start the tutorial by running git-it
.",
"Note that you can resize the c9.io's windows by dragging their borders.",
"Make sure that you are always in your project's \"workspace\" directory. You can always navigate back to this directory by running this command: cd ~/workspace
.",
diff --git a/seed/challenges/html5-and-css.json b/seed/challenges/html5-and-css.json
index ab0d2c12a3..051b6764c7 100644
--- a/seed/challenges/html5-and-css.json
+++ b/seed/challenges/html5-and-css.json
@@ -372,7 +372,7 @@
"difficulty": 1.09,
"description": [
"Delete your h2
element's style attribute and instead create a CSS style
element. Add the necessary CSS to turn all h2
elements blue.",
- "With CSS, there are hundreds of CSS attributes
that you can use to change the way an element looks on your page.",
+ "With CSS, there are hundreds of CSS properties
that you can use to change the way an element looks on your page.",
"When you entered <h2 style=\"color: red\">CatPhotoApp</h2>
, you were giving that individual h2
element an inline style
.",
"That's one way to add style to an element, but a better way is by using CSS
, which stands for Cascading Style Sheets
.",
"At the top of your code, create a style
element like this: <style></style>
.",
@@ -383,7 +383,7 @@
"assert(!$(\"h2\").attr(\"style\"), 'Remove the style attribute from your h2
element.')",
"assert($(\"style\") && $(\"style\").length > 1, 'Create a style
element.')",
"assert($(\"h2\").css(\"color\") === \"rgb(0, 0, 255)\", 'Your h2
element should be blue.')",
- "assert(editor.match(/<\\/style>/g) && editor.match(/<\\/style>/g).length === editor.match(/",
"",
@@ -2623,7 +2628,7 @@
"difficulty": 1.40,
"description": [
"You may have already noticed this, but all HTML elements are essentially little rectangles.",
- "Three important attributes control the space that surrounds each HTML element: padding
, margin
, and border
.",
+ "Three important properties control the space that surrounds each HTML element: padding
, margin
, and border
.",
"An element's padding
controls the amount of space between the element and its border
.",
"Here, we can see that the green box and the red box are nested within the yellow box. Note that the red box has more padding
than the green box.",
"When you increase the green box's padding
, it will increase the distance between the text padding
and the border around it.",
@@ -2835,14 +2840,14 @@
"difficulty": 1.43,
"description": [
"Sometimes you will want to customize an element so that it has different padding
on each of its sides.",
- "CSS allows you to control the padding
of an element on all four sides with padding-top
, padding-right
, padding-bottom
, and padding-left
attributes.",
+ "CSS allows you to control the padding
of an element on all four sides with padding-top
, padding-right
, padding-bottom
, and padding-left
properties.",
"Give the green box a padding
of 40px
on its top and left side, but only 20px
on its bottom and right side."
],
"tests": [
- "assert($(\".green-box\").css(\"padding-top\") === \"40px\", 'Your green-box
class should give the top of elements 40px
of padding
.')",
- "assert($(\".green-box\").css(\"padding-left\") === \"40px\", 'Your green-box
class should give the left of elements 40px
of padding
.')",
- "assert($(\".green-box\").css(\"padding-right\") === \"20px\", 'Your green-box
class should give the right of elements 20px
of padding
.')",
- "assert($(\".green-box\").css(\"padding-bottom\") === \"20px\", 'Your green-box
class should give the bottom of elements 20px
of padding
.')"
+ "assert($(\".green-box\").css(\"padding-top\") === \"40px\", 'Your green-box
class should give the top of the elements 40px
of padding
.')",
+ "assert($(\".green-box\").css(\"padding-left\") === \"40px\", 'Your green-box
class should give the left of the elements 40px
of padding
.')",
+ "assert($(\".green-box\").css(\"padding-right\") === \"20px\", 'Your green-box
class should give the right of the elements 20px
of padding
.')",
+ "assert($(\".green-box\").css(\"padding-bottom\") === \"20px\", 'Your green-box
class should give the bottom of the elements 20px
of padding
.')"
],
"challengeSeed": [
"