From c681c2e8587d1a7ef54fecf72117f5f0cb14dc2d Mon Sep 17 00:00:00 2001 From: evaristoc Date: Wed, 23 Dec 2015 23:31:48 +0100 Subject: [PATCH 001/174] ga completion event modif --- client/commonFramework/execute-challenge-stream.js | 4 ---- client/commonFramework/show-completion.js | 4 ++-- server/views/coursewares/showBonfire.jade | 1 - server/views/coursewares/showHTML.jade | 2 -- server/views/coursewares/showJS.jade | 1 - server/views/coursewares/showZiplineOrBasejump.jade | 1 - 6 files changed, 2 insertions(+), 11 deletions(-) diff --git a/client/commonFramework/execute-challenge-stream.js b/client/commonFramework/execute-challenge-stream.js index 2a29b9edf6..b81de64486 100644 --- a/client/commonFramework/execute-challenge-stream.js +++ b/client/commonFramework/execute-challenge-stream.js @@ -13,8 +13,6 @@ window.common = (function(global) { challengeTypes } = common; - let attempts = 0; - common.executeChallenge$ = function executeChallenge$() { const code = common.editor.getValue(); const originalCode = code; @@ -22,8 +20,6 @@ window.common = (function(global) { const tail = common.arrayToNewLineString(common.tail); const combinedCode = head + code + tail; - attempts++; - ga('send', 'event', 'Challenge', 'ran-code', common.challengeName); // run checks for unsafe code diff --git a/client/commonFramework/show-completion.js b/client/commonFramework/show-completion.js index 363e054478..5080efd629 100644 --- a/client/commonFramework/show-completion.js +++ b/client/commonFramework/show-completion.js @@ -6,14 +6,14 @@ window.common = (function(global) { } = global; common.showCompletion = function showCompletion() { - var time = Math.floor(Date.now() - common.started); ga( 'send', 'event', 'Challenge', 'solved', - common.challengeName + ', Time: ' + time + ', Attempts: ' + 0 + common.challengeName, + true ); var solution = common.editor.getValue(); diff --git a/server/views/coursewares/showBonfire.jade b/server/views/coursewares/showBonfire.jade index fdd408fd67..0196efbb2a 100644 --- a/server/views/coursewares/showBonfire.jade +++ b/server/views/coursewares/showBonfire.jade @@ -92,7 +92,6 @@ block content common.challengeType = !{JSON.stringify(challengeType)}; common.dashedName = !{JSON.stringify(dashedName)}; - common.started = Math.floor(Date.now()); common.username = !{JSON.stringify(user && user.username || '')}; include ../partials/challenge-footer diff --git a/server/views/coursewares/showHTML.jade b/server/views/coursewares/showHTML.jade index 1ca92040b4..8b8539dd28 100644 --- a/server/views/coursewares/showHTML.jade +++ b/server/views/coursewares/showHTML.jade @@ -86,7 +86,6 @@ block content common.challengeType = !{JSON.stringify(challengeType)}; common.dashedName = !{JSON.stringify(dashedName)}; - common.started = Math.floor(Date.now()); common.init.push(function() { common.editor.setOption('lint', false); common.editor.setOption('mode', 'text/html'); @@ -99,4 +98,3 @@ block content window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn'); } }); - diff --git a/server/views/coursewares/showJS.jade b/server/views/coursewares/showJS.jade index 3b4c1131b4..4ca73e1f02 100644 --- a/server/views/coursewares/showJS.jade +++ b/server/views/coursewares/showJS.jade @@ -88,7 +88,6 @@ block content common.challengeType = !{JSON.stringify(challengeType)}; common.dashedName = !{JSON.stringify(dashedName)}; - common.started = Math.floor(Date.now()); include ../partials/challenge-footer script. diff --git a/server/views/coursewares/showZiplineOrBasejump.jade b/server/views/coursewares/showZiplineOrBasejump.jade index 30c90ffec7..03c1ebb19e 100644 --- a/server/views/coursewares/showZiplineOrBasejump.jade +++ b/server/views/coursewares/showZiplineOrBasejump.jade @@ -72,7 +72,6 @@ block content var common = window.common || { init: [] }; common.challengeId = !{JSON.stringify(challengeId)}; common.challengeName = !{JSON.stringify(name)}; - common.started = Math.floor(Date.now()); common.dashedName = !{JSON.stringify(dashedName)}; common.challengeType = !{JSON.stringify(challengeType)}; From c4aaeaf887bf8e96205a31559b4e4d20ea1e7050 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Fri, 25 Dec 2015 15:17:15 -0600 Subject: [PATCH 002/174] write data export script --- seed/get-challenge-completion.js | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 seed/get-challenge-completion.js diff --git a/seed/get-challenge-completion.js b/seed/get-challenge-completion.js new file mode 100644 index 0000000000..f66856f72d --- /dev/null +++ b/seed/get-challenge-completion.js @@ -0,0 +1,34 @@ +/* eslint-disable no-process-exit */ +require('dotenv').load(); +var secrets = require('../config/secrets'), + mongodb = require('mongodb'), + MongoClient = mongodb.MongoClient, + _ = require('lodash'); + +MongoClient.connect(secrets.db, function(err, database) { + if (err) { + throw err; + } + + database.collection('user').aggregate([ + {$match: { 'completedChallenges': { $exists: true } } }, + {$match: { 'completedChallenges': { $ne: '' } } }, + {$match: { 'completedChallenges': { $ne: null } } }, + {$group: { '_id': 1, 'completedChallenges': {$addToSet: '$completedChallenges' } } } + ], function(err, results) { + if (err) { throw err; } + var testout = results.map(function(camper) { + return _.flatten(camper.completedChallenges.map(function(challenges) { + return challenges.map(function(challenge) { + return { + name: challenge.name, + completedDate: challenge.completedDate, + solution: challenge.solution + }; + }); + }), true); + }); + console.log(JSON.stringify(testout)); + process.exit(0); + }); +}); \ No newline at end of file From 912d515148c7c06bc3231ac9e32ee523b5c8dfa2 Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Fri, 25 Dec 2015 21:31:13 -0800 Subject: [PATCH 003/174] Data creation script --- seed/get-challenge-completion.js | 55 +++++++++++++++++++------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/seed/get-challenge-completion.js b/seed/get-challenge-completion.js index f66856f72d..364451b012 100644 --- a/seed/get-challenge-completion.js +++ b/seed/get-challenge-completion.js @@ -1,34 +1,45 @@ /* eslint-disable no-process-exit */ + +/** + * Data creation script for academic data pushes. Run this script with + * node seed/get-challenge-completion.js >> ~/output.json + * For large data sets supply the flag --max_old_space_size=2000000 to node. + * Run from the root FCC directory. Beware, this will generate a very large file + * if you have a large user collection such as the production mongo db. +*/ + require('dotenv').load(); var secrets = require('../config/secrets'), mongodb = require('mongodb'), - MongoClient = mongodb.MongoClient, - _ = require('lodash'); + MongoClient = mongodb.MongoClient; MongoClient.connect(secrets.db, function(err, database) { if (err) { throw err; } - - database.collection('user').aggregate([ - {$match: { 'completedChallenges': { $exists: true } } }, - {$match: { 'completedChallenges': { $ne: '' } } }, - {$match: { 'completedChallenges': { $ne: null } } }, - {$group: { '_id': 1, 'completedChallenges': {$addToSet: '$completedChallenges' } } } - ], function(err, results) { - if (err) { throw err; } - var testout = results.map(function(camper) { - return _.flatten(camper.completedChallenges.map(function(challenges) { - return challenges.map(function(challenge) { - return { - name: challenge.name, - completedDate: challenge.completedDate, - solution: challenge.solution - }; + var stream = database.collection('user') + .find({'completedChallenges': { $ne: null }}, + {'completedChallenges': true}) + .stream(); + console.log('['); + stream.on('data', function(results) { + if (!results.completedChallenges) { + // dud + } else { + var testout = []; + results.completedChallenges.forEach(function(challenge) { + testout.push({ + name: challenge.name, + completedDate: challenge.completedDate, + solution: challenge.solution }); - }), true); - }); - console.log(JSON.stringify(testout)); + }); + if (testout.length) { + console.log(JSON.stringify(testout) + ','); + } + } + }).on('end', function() { + console.log(']'); process.exit(0); }); -}); \ No newline at end of file +}); From eb5ff7f0c7104f7322d449e24b34f907a277af32 Mon Sep 17 00:00:00 2001 From: terakilobyte Date: Sat, 26 Dec 2015 09:55:16 -0800 Subject: [PATCH 004/174] Do not collect camper data of private campers --- seed/get-challenge-completion.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/seed/get-challenge-completion.js b/seed/get-challenge-completion.js index 364451b012..06688b1e2c 100644 --- a/seed/get-challenge-completion.js +++ b/seed/get-challenge-completion.js @@ -18,7 +18,8 @@ MongoClient.connect(secrets.db, function(err, database) { throw err; } var stream = database.collection('user') - .find({'completedChallenges': { $ne: null }}, + .find({'completedChallenges': { $ne: null }, + 'isLocked': { $ne: true } }, {'completedChallenges': true}) .stream(); console.log('['); @@ -26,16 +27,16 @@ MongoClient.connect(secrets.db, function(err, database) { if (!results.completedChallenges) { // dud } else { - var testout = []; + var dataOut = []; results.completedChallenges.forEach(function(challenge) { - testout.push({ + dataOut.push({ name: challenge.name, completedDate: challenge.completedDate, solution: challenge.solution }); }); - if (testout.length) { - console.log(JSON.stringify(testout) + ','); + if (dataOut.length) { + console.log(JSON.stringify(dataOut) + ','); } } }).on('end', function() { From 3f52753d9e17fd380559e77b281ec393f1c5601b Mon Sep 17 00:00:00 2001 From: Charlie Mantle Date: Mon, 21 Dec 2015 22:51:17 -0800 Subject: [PATCH 005/174] Added extra test cases for Bonfire: Chunkey Monkey Added missing comma's for test cases --- .../basic-bonfires.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-bonfires.json b/seed/challenges/01-front-end-development-certification/basic-bonfires.json index 11560772d6..42f6683048 100644 --- a/seed/challenges/01-front-end-development-certification/basic-bonfires.json +++ b/seed/challenges/01-front-end-development-certification/basic-bonfires.json @@ -545,7 +545,9 @@ "assert.deepEqual(chunk([\"a\", \"b\", \"c\", \"d\"], 2), [[\"a\", \"b\"], [\"c\", \"d\"]], 'message: chunk([\"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]], 'message: chunk([0, 1, 2, 3, 4, 5], 3) should return [[0, 1, 2], [3, 4, 5]].');", "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], 'message: chunk([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]], 'message: chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');" + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'message: chunk([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]], 'message: chunk([0, 1, 2, 3, 4, 5, 6], 3) should return [[0, 1, 2], [3, 4, 5], [6]].');", + "assert.deepEqual(chunk([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]], 'message: chunk([0, 1, 2, 3, 4, 5, 6, 7, 8], 4) should return [[0, 1, 2, 3], [4, 5, 6, 7], [8]].');" ], "MDNlinks": [ "Array.push()", From 757f400fcedaeb3ad3dcb62b5ce3156adc11229c Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 27 Dec 2015 23:20:11 -0600 Subject: [PATCH 006/174] start adding API Basejumps --- .../api-projects.json | 314 +++++++++++++++--- .../dynamic-web-applications.json | 209 +----------- 2 files changed, 278 insertions(+), 245 deletions(-) diff --git a/seed/challenges/03-back-end-development-certification/api-projects.json b/seed/challenges/03-back-end-development-certification/api-projects.json index 5cf89e5412..be7b9661d9 100644 --- a/seed/challenges/03-back-end-development-certification/api-projects.json +++ b/seed/challenges/03-back-end-development-certification/api-projects.json @@ -5,10 +5,209 @@ "time": "100h", "challenges": [ { - "id": "bd7158d8c443edefaeb5bdef", - "title": "API Project 1", + "id": "bd7158d8c443eddfaeb5bcef", + "title": "Get Set for Basejumps", "challengeSeed": [], "description": [ + [ + "http://i.imgur.com/4IZjWZ3.gif", + "A gif showing how to create a c9.io account.", + "We recommend building our full stack Basejump challenges on c9.io, a powerful browser-based development environment. This save you hours of time that you would spend configuring your local computer to run Node.js and MongoDB - time you could instead spend coding.
Create a c9.io account by clicking the GitHub symbol in the upper right hand corner of the c9.io page. Click the big plus symbol to create a new workspace. Enter your email address when prompted.", + "http://c9.io" + ], + [ + "http://i.imgur.com/F7i5Hhi.gif", + "A gif showing how to fill out the new workspace form", + "Instead of starting from scratch, we recommend using Clementine.js, a full stack JavaScript \"boilerplate\" that already has some basic code written for you. Clementine.js has a detailed tutorial you can go through to build it yourself, but for now let's just clone its code. On c9.io, give your workspace a name, then leave \"Template\" as custom and create your workspace from this GitHub url: https://github.com/johnstonbl01/clementinejs-fcc.git", + "" + ], + [ + "http://i.imgur.com/42m1vyr.gif", + "A gif showing you how to show hidden files.", + "Click the gear in the upper right corner of c9.io's file structure. Select \"show hidden files\".", + "" + ], + [ + "http://i.imgur.com/qrE8xaK.gif", + "A gif showing you how to create a new file.", + "Right click and create a new file called .env.", + "" + ], + [ + "http://i.imgur.com/jkQX9SQ.gif", + "A gif showing you how to prep your environmental variables in your .env file.", + "Open your .env file and paste this into it, then save it:
GITHUB_KEY=
GITHUB_SECRET=
MONGO_URI=mongodb://localhost:27017/clementinejs
PORT=8080
APP_URL=http://localhost:8080/
", + "" + ], + [ + "http://i.imgur.com/f3DE7zB.gif", + "A gif showing you how to open c9.io's preview window.", + "Open up your application in a preview tab by clicking window > share > application > open.", + "" + ], + [ + "http://i.imgur.com/Ip0qUdQ.gif", + "A gif showing you how to create a GitHub app using c9.io's preview URL.", + "Create a GitHub app for authentication and choose an \"Application name\". For the homepage URL, paste the URL from your preview tab. You'll also paste the URL from your preview tab into \"Authorization callback URL\", then add to it: auth/github/callback", + "https://github.com/settings/applications/new" + ], + [ + "http://i.imgur.com/qCUVRFb.gif", + "A gif showing you how to transfer GitHub's key and secret over to your .env file, as well as your c9.io URL.", + "GitHub will create an app and present you with a Client ID and a Client Secret. Set your .env file's GITHUB_KEY equal to the Client ID, and set your .env file's GITHUB_SECRET equal to the Client Secret. Copy the URL from the your preview tab and paste it into your .env file as your APP_URL.", + "" + ], + [ + "http://i.imgur.com/2a20Vah.gif", + "A gif showing you how to start mongoDB in c9.io's terminal.", + "In your terminal, start MongoDB by entering mongod --smallfiles", + "" + ], + [ + "http://i.imgur.com/dC55pWk.gif", + "A gif showing you how to open a new tab in c9.io's terminal.", + "Open a new terminal tab with the + button above your terminal, then run npm install", + "" + ], + [ + "http://i.imgur.com/54OC2Ro.gif", + "A gif showing you how to navigate to your preview tab and sign in to your new Clementine.js app.", + "Run node server.js to start the server. Refresh your preview tab. You should see the Clementine.js logo. Click \"sign in\" and accept GitHub's prompt to authorize the application.", + "" + ], + [ + "http://i.imgur.com/2IJfyvN.gif", + "A gif showing you how to click the button to trigger an AJAX action with Clementine.js and how to look at your user profile from the GitHub authentication data.", + "Click the \"click me\" button and you'll see that it increments the number clicks. Click the profile button and you'll see that it has your GitHub information.", + "" + ], + [ + "http://i.imgur.com/bjO5pnq.gif", + "A gif showing you how to create a new GitHub repository and push your code up to it.", + "Create a new GitHub repository. Then copy its .git URL.
Return to c9.io's terminal and set your GitHub remote URL: git remote set-url origin followed by the URL you copied from GitHub.
Run git push origin master.
Now tab back to GitHub and refresh, and you'll see that your code is now on GitHub.", + "https://github.com/new" + ], + [ + "http://i.imgur.com/Qn0K65B.gif", + "A gif showing you how to add add-ons to Heroku.", + "We will soon add instructions for getting Clementine running on Heroku. For now, develop your Basejumps right on c9.io.", + "" + ] + ], + "type": "Waypoint", + "challengeType": 7, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "Prepárate para los Basejumps", + "descriptionEs": [ + [ + "http://i.imgur.com/4IZjWZ3.gif", + "Una imagen gif que te muestra cómo crear una cuenta en c9.io.", + "Te recomendamos resolver nuestros desafíos de pila completa (full stack) en c9.io, un poderoso ambiente de desarrollo basado en tu navegador. Esto te ahorrará muchas horas que utilizarías configurando tu computadora para correr Node.js y MongoDB - tiempo que podrías utilizar escribiendo código.
Crea una cuenta en c9.io pulsando el símbolo de GitHub en la esquina superior derecha de la página de c9.io. Pulsa el botón con el símbolo de suma para crear una área de trabajo nueva. Introduce tu dirección de correo electrónico cuando se te solicite.", + "http://c9.io" + ], + [ + "http://i.imgur.com/F7i5Hhi.gif", + "Una imagen gif que te muestra cómo llenar el formulario para crear un área de trabajo nueva", + "En vez de iniciar desde cero, recomendamos utilizar Clementine.js, un modelo (bolierplate) de JavaScript pila completa (full stack) que viene con código básico ya escrito para ti. Clementine.js tiene un tutorial detallado que puedes seguir para construirlo por ti mismo, pero por ahora simplemente vamos a clonarlo. En c9.io, dale un nombre a tu área de trabajo, luego deja \"Plantilla\" (\"Template\") como personalizado y crea tu espacio de trabajo usando el siguiente url de Github: https://github.com/johnstonbl01/clementinejs-fcc.git", + "" + ], + [ + "http://i.imgur.com/42m1vyr.gif", + "Una imagen gif que te muestra cómo mostrar los archivos ocultos.", + "Pulsa el engrane en la esquina superior derecha del árbol de archivos de c9.io. Selecciona \"show hidden files\".", + "" + ], + [ + "http://i.imgur.com/qrE8xaK.gif", + "Una imagen gif que te muestra cómo crear un archivo nuevo.", + "Haciendo clic derecho, crea un nuevo archivo llamado .env.", + "" + ], + [ + "http://i.imgur.com/jkQX9SQ.gif", + "Una imagen gif que te muestra cómo preparar tus variables de ambiente en tu archivo .env.", + "Abre tu archivo .env pega el siguiente código, y luego guárdalo:
GITHUB_KEY=
GITHUB_SECRET=
MONGO_URI=mongodb://localhost:27017/clementinejs
PORT=8080
APP_URL=http://localhost:8080/
", + "" + ], + [ + "http://i.imgur.com/f3DE7zB.gif", + "Una imagen gif que te muestra cómo abir la vista previa de la ventana de c9.io.", + "Abre tu aplicación en una pestaña de vista previa pulsando window > share > application > open.", + "" + ], + [ + "http://i.imgur.com/Ip0qUdQ.gif", + "Una imagen gif que te muestra cómo crear una aplicación de GitHub usando la URL de vista previa de c9.io.", + "Crea una aplicación de GitHub para autenticación y elige un \"Nombre de aplicación\". Para la URL de inicio (homepage), pega la URL de tu pestaña de vista previa. También debes pegar la URL de tu pestaña de vista previa en Authorization callback URL, agrégale: auth/github/callback", + "https://github.com/settings/applications/new" + ], + [ + "http://i.imgur.com/qCUVRFb.gif", + "Una imagen gif que te muestra cómo transferir tu llave (key) y tu código secreto (secret) de GitHub a tu archivo .env, así como tu URL de c9.io.", + "GitHub creará una aplicación y te entregará un ID de cliente (Client ID) y un Código secreto de cliente (Client Secret). Haz que el GITHUB_KEY en tu archivo .env sea igual al ID de cliente, y haz que tu GITHUB_SECRET en el archivo .env sea igual al Código secreto de cliente. Copia la URL de tu pestaña de vista previa y pégala en tu archivo .env como tu APP_URL.", + "" + ], + [ + "http://i.imgur.com/2a20Vah.gif", + "Una imagen gif que te muestra cómo iniciar mongoDB en la terminal de c9.io.", + "En tu terminal, inicia MongoDB con el siguiente comando: mongod --smallfiles", + "" + ], + [ + "http://i.imgur.com/dC55pWk.gif", + "Una imagen gif que te muestra cómo abrir una nueva pestaña en la terminal de c9.io.", + "Abre una nueva pestaña de terminal pulsando el botón de + sobre tu terminal, luego ejecuta npm install", + "" + ], + [ + "http://i.imgur.com/54OC2Ro.gif", + "Una imagen gif que te muestra cómo navegar a tu pestaña de vista previa e ingresar a tu nueva aplicación Clementine.js.", + "Ejecuta node server.js para iniciar el servidor. Actualiza tu pestaña de vista previa. Deberías poder ver el logo de Clementine.js. Pulsa \"sign in\" y acepta la solicitud de GitHub para autorizar la aplicación.", + "" + ], + [ + "http://i.imgur.com/2IJfyvN.gif", + "Una imagen gif que te muestra cómo pulsar un botón para desencadenar una acción AJAX con Clementine.js y cómo ver tu perfil de usuario en los datos de autenticación provistos por GitHub.", + "Pulsa el botón que dice \"click me\" y verás que se incrementa el número de clics. Pulsa el botón de perfil (profile) y verás la información de tu perfil de GitHub.", + "" + ], + [ + "http://i.imgur.com/bjO5pnq.gif", + "Una imagen gif que te muestra cómo crear un nuevo repositorio de GitHub GitHub y empujar allí tu código.", + "Crea un nuevo repositorio en GitHub. Luego copia su ULR .git.
Regresa a tu terminal de c9.io y establece tu URL remota de GitHub: git remote set-url origin seguido de la URL que copiaste de GitHub.
Ejecuta git push origin master.
Ahora ve de regreso a la página de GitHub y actualízala. Verás que tu código ahora está ahora en GitHub.", + "https://github.com/new" + ], + [ + "http://i.imgur.com/Qn0K65B.gif", + "Una imagen gif que te muestra cómo agregar complementos a Heroku.", + "Pronto agregaremos instrucciones para hacer que Clementine corra en Heroku. Por ahora, desarrolla tus Basejumps en c9.io.", + "" + ] + ], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "bd7158d8c443edefaeb5bdef", + "title": "Timestamp Microservice", + "challengeSeed": [ + "133315784" + ], + "description": [ + "Objective: Build a full stack JavaScript app that is functionally similar to this: https://timestamp-ms.herokuapp.com/ and deploy it to Heroku.", + "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", + "Here are the specific user stories you should implement for this Basejump:", + "User Story: I can pass a string as a parameter, and it will check to see whether that string contains either a unix timestamp or a natural language date (example: January 1, 2016).", + "User Story: If it does, it returns both the Unix timestamp and the natural language form of that date.", + "User Story: If it does not contain a date or Unix timestamp, it returns null for those properties.", + "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.", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", "challengeType": 4, @@ -19,17 +218,24 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea una aplicación de votaciones", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c443edefaeb5bdff", - "title": "API Project 2", - "challengeSeed": [], + "title": "Request Header Parser Microservice", + "challengeSeed": [ + "133315784" + ], "description": [ + "Objective: Build a full stack JavaScript app that is functionally similar to this: https://cryptic-ridge-9197.herokuapp.com/api/whoami/ and deploy it to Heroku.", + "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", + "Here's the specific user story you should implement for this Basejump:", + "User Story: I can get the IP address, language and operating system for my browser.", + "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.", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", "challengeType": 4, @@ -40,17 +246,26 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea una aplicación de coordinación de vida nocturna", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c443edefaeb5bd0e", - "title": "API Project 3", - "challengeSeed": [], + "title": "URL Shortener Microservice", + "challengeSeed": [ + "133315784" + ], "description": [ + "Objective: Build a full stack JavaScript app that is functionally similar to this: https://shurli.herokuapp.com/ and deploy it to Heroku.", + "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", + "Here are the specific user stories you should implement for this Basejump:", + "User Story: I can pass a URL as a parameter and I will receive a shortened URL in the JSON response.", + "User Story: If I pass an invalid URL that doesn't follow the valid http://www.example.com format, the JSON response will contain an error instead.", + "User Story: When I visit that shortened URL, it will redirect me to my original link.", + "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.", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", "challengeType": 4, @@ -61,38 +276,26 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Grafica el mercado de acciones", - "descriptionEs": [ - ], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7158d8c443edefaeb5bd0f", - "title": "API Project 4", - "challengeSeed": [], - "description": [ - ], - "type": "basejump", - "challengeType": 4, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "Administra un club de intercambio de libros", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c443edefaeb5bdee", "title": "API Project 5", - "challengeSeed": ["133315784"], + "challengeSeed": [ + "133315784" + ], "description": [ + "Objective: Build a full stack JavaScript app that is functionally similar to this: https://cryptic-ridge-9197.herokuapp.com/api/latest/imagesearch/ and deploy it to Heroku.", + "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", + "Here are the specific user stories you should implement for this Basejump:", + "User Story: ", + "User Story: ", + "User Story: ", + "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.", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", "challengeType": 4, @@ -103,11 +306,40 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea un clon de Pinterest", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "bd7158d8c443edefaeb5bd0f", + "title": "Filesize Checker", + "challengeSeed": [ + "133315784" + ], + "description": [ + "Objective: Build a full stack JavaScript app that is functionally similar to this: https://cryptic-ridge-9197.herokuapp.com/ and deploy it to Heroku.", + "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", + "Here are the specific user stories you should implement for this Basejump:", + "User Story: I can submit a FormData object that includes a file upload.", + "User Story: When I submit something, I will receive the file size in bytes within the JSON response", + "Hint: You may want to use this package: https://www.npmjs.com/package/multer", + "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.", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." + ], + "type": "basejump", + "challengeType": 4, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] } ] -} +} \ No newline at end of file diff --git a/seed/challenges/03-back-end-development-certification/dynamic-web-applications.json b/seed/challenges/03-back-end-development-certification/dynamic-web-applications.json index 690122f2da..3ea9f68844 100644 --- a/seed/challenges/03-back-end-development-certification/dynamic-web-applications.json +++ b/seed/challenges/03-back-end-development-certification/dynamic-web-applications.json @@ -3,195 +3,6 @@ "order": 27, "time": "200h", "challenges": [ - { - "id": "bd7158d8c443eddfaeb5bcef", - "title": "Get Set for Basejumps", - "challengeSeed": [], - "description": [ - [ - "http://i.imgur.com/4IZjWZ3.gif", - "A gif showing how to create a c9.io account.", - "We recommend building our full stack Basejump challenges on c9.io, a powerful browser-based development environment. This save you hours of time that you would spend configuring your local computer to run Node.js and MongoDB - time you could instead spend coding.
Create a c9.io account by clicking the GitHub symbol in the upper right hand corner of the c9.io page. Click the big plus symbol to create a new workspace. Enter your email address when prompted.", - "http://c9.io" - ], - [ - "http://i.imgur.com/F7i5Hhi.gif", - "A gif showing how to fill out the new workspace form", - "Instead of starting from scratch, we recommend using Clementine.js, a full stack JavaScript \"boilerplate\" that already has some basic code written for you. Clementine.js has a detailed tutorial you can go through to build it yourself, but for now let's just clone its code. On c9.io, give your workspace a name, then leave \"Template\" as custom and create your workspace from this GitHub url: https://github.com/johnstonbl01/clementinejs-fcc.git", - "" - ], - [ - "http://i.imgur.com/42m1vyr.gif", - "A gif showing you how to show hidden files.", - "Click the gear in the upper right corner of c9.io's file structure. Select \"show hidden files\".", - "" - ], - [ - "http://i.imgur.com/qrE8xaK.gif", - "A gif showing you how to create a new file.", - "Right click and create a new file called .env.", - "" - ], - [ - "http://i.imgur.com/jkQX9SQ.gif", - "A gif showing you how to prep your environmental variables in your .env file.", - "Open your .env file and paste this into it, then save it:
GITHUB_KEY=
GITHUB_SECRET=
MONGO_URI=mongodb://localhost:27017/clementinejs
PORT=8080
APP_URL=http://localhost:8080/
", - "" - ], - [ - "http://i.imgur.com/f3DE7zB.gif", - "A gif showing you how to open c9.io's preview window.", - "Open up your application in a preview tab by clicking window > share > application > open.", - "" - ], - [ - "http://i.imgur.com/Ip0qUdQ.gif", - "A gif showing you how to create a GitHub app using c9.io's preview URL.", - "Create a GitHub app for authentication and choose an \"Application name\". For the homepage URL, paste the URL from your preview tab. You'll also paste the URL from your preview tab into \"Authorization callback URL\", then add to it: auth/github/callback", - "https://github.com/settings/applications/new" - ], - [ - "http://i.imgur.com/qCUVRFb.gif", - "A gif showing you how to transfer GitHub's key and secret over to your .env file, as well as your c9.io URL.", - "GitHub will create an app and present you with a Client ID and a Client Secret. Set your .env file's GITHUB_KEY equal to the Client ID, and set your .env file's GITHUB_SECRET equal to the Client Secret. Copy the URL from the your preview tab and paste it into your .env file as your APP_URL.", - "" - ], - [ - "http://i.imgur.com/2a20Vah.gif", - "A gif showing you how to start mongoDB in c9.io's terminal.", - "In your terminal, start MongoDB by entering mongod --smallfiles", - "" - ], - [ - "http://i.imgur.com/dC55pWk.gif", - "A gif showing you how to open a new tab in c9.io's terminal.", - "Open a new terminal tab with the + button above your terminal, then run npm install", - "" - ], - [ - "http://i.imgur.com/54OC2Ro.gif", - "A gif showing you how to navigate to your preview tab and sign in to your new Clementine.js app.", - "Run node server.js to start the server. Refresh your preview tab. You should see the Clementine.js logo. Click \"sign in\" and accept GitHub's prompt to authorize the application.", - "" - ], - [ - "http://i.imgur.com/2IJfyvN.gif", - "A gif showing you how to click the button to trigger an AJAX action with Clementine.js and how to look at your user profile from the GitHub authentication data.", - "Click the \"click me\" button and you'll see that it increments the number clicks. Click the profile button and you'll see that it has your GitHub information.", - "" - ], - [ - "http://i.imgur.com/bjO5pnq.gif", - "A gif showing you how to create a new GitHub repository and push your code up to it.", - "Create a new GitHub repository. Then copy its .git URL.
Return to c9.io's terminal and set your GitHub remote URL: git remote set-url origin followed by the URL you copied from GitHub.
Run git push origin master.
Now tab back to GitHub and refresh, and you'll see that your code is now on GitHub.", - "https://github.com/new" - ], - [ - "http://i.imgur.com/Qn0K65B.gif", - "A gif showing you how to add add-ons to Heroku.", - "We will soon add instructions for getting Clementine running on Heroku. For now, develop your Basejumps right on c9.io.", - "" - ] - ], - "type": "Waypoint", - "challengeType": 7, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "Prepárate para los Basejumps", - "descriptionEs": [ - [ - "http://i.imgur.com/4IZjWZ3.gif", - "Una imagen gif que te muestra cómo crear una cuenta en c9.io.", - "Te recomendamos resolver nuestros desafíos de pila completa (full stack) en c9.io, un poderoso ambiente de desarrollo basado en tu navegador. Esto te ahorrará muchas horas que utilizarías configurando tu computadora para correr Node.js y MongoDB - tiempo que podrías utilizar escribiendo código.
Crea una cuenta en c9.io pulsando el símbolo de GitHub en la esquina superior derecha de la página de c9.io. Pulsa el botón con el símbolo de suma para crear una área de trabajo nueva. Introduce tu dirección de correo electrónico cuando se te solicite.", - "http://c9.io" - ], - [ - "http://i.imgur.com/F7i5Hhi.gif", - "Una imagen gif que te muestra cómo llenar el formulario para crear un área de trabajo nueva", - "En vez de iniciar desde cero, recomendamos utilizar Clementine.js, un modelo (bolierplate) de JavaScript pila completa (full stack) que viene con código básico ya escrito para ti. Clementine.js tiene un tutorial detallado que puedes seguir para construirlo por ti mismo, pero por ahora simplemente vamos a clonarlo. En c9.io, dale un nombre a tu área de trabajo, luego deja \"Plantilla\" (\"Template\") como personalizado y crea tu espacio de trabajo usando el siguiente url de Github: https://github.com/johnstonbl01/clementinejs-fcc.git", - "" - ], - [ - "http://i.imgur.com/42m1vyr.gif", - "Una imagen gif que te muestra cómo mostrar los archivos ocultos.", - "Pulsa el engrane en la esquina superior derecha del árbol de archivos de c9.io. Selecciona \"show hidden files\".", - "" - ], - [ - "http://i.imgur.com/qrE8xaK.gif", - "Una imagen gif que te muestra cómo crear un archivo nuevo.", - "Haciendo clic derecho, crea un nuevo archivo llamado .env.", - "" - ], - [ - "http://i.imgur.com/jkQX9SQ.gif", - "Una imagen gif que te muestra cómo preparar tus variables de ambiente en tu archivo .env.", - "Abre tu archivo .env pega el siguiente código, y luego guárdalo:
GITHUB_KEY=
GITHUB_SECRET=
MONGO_URI=mongodb://localhost:27017/clementinejs
PORT=8080
APP_URL=http://localhost:8080/
", - "" - ], - [ - "http://i.imgur.com/f3DE7zB.gif", - "Una imagen gif que te muestra cómo abir la vista previa de la ventana de c9.io.", - "Abre tu aplicación en una pestaña de vista previa pulsando window > share > application > open.", - "" - ], - [ - "http://i.imgur.com/Ip0qUdQ.gif", - "Una imagen gif que te muestra cómo crear una aplicación de GitHub usando la URL de vista previa de c9.io.", - "Crea una aplicación de GitHub para autenticación y elige un \"Nombre de aplicación\". Para la URL de inicio (homepage), pega la URL de tu pestaña de vista previa. También debes pegar la URL de tu pestaña de vista previa en Authorization callback URL, agrégale: auth/github/callback", - "https://github.com/settings/applications/new" - ], - [ - "http://i.imgur.com/qCUVRFb.gif", - "Una imagen gif que te muestra cómo transferir tu llave (key) y tu código secreto (secret) de GitHub a tu archivo .env, así como tu URL de c9.io.", - "GitHub creará una aplicación y te entregará un ID de cliente (Client ID) y un Código secreto de cliente (Client Secret). Haz que el GITHUB_KEY en tu archivo .env sea igual al ID de cliente, y haz que tu GITHUB_SECRET en el archivo .env sea igual al Código secreto de cliente. Copia la URL de tu pestaña de vista previa y pégala en tu archivo .env como tu APP_URL.", - "" - ], - [ - "http://i.imgur.com/2a20Vah.gif", - "Una imagen gif que te muestra cómo iniciar mongoDB en la terminal de c9.io.", - "En tu terminal, inicia MongoDB con el siguiente comando: mongod --smallfiles", - "" - ], - [ - "http://i.imgur.com/dC55pWk.gif", - "Una imagen gif que te muestra cómo abrir una nueva pestaña en la terminal de c9.io.", - "Abre una nueva pestaña de terminal pulsando el botón de + sobre tu terminal, luego ejecuta npm install", - "" - ], - [ - "http://i.imgur.com/54OC2Ro.gif", - "Una imagen gif que te muestra cómo navegar a tu pestaña de vista previa e ingresar a tu nueva aplicación Clementine.js.", - "Ejecuta node server.js para iniciar el servidor. Actualiza tu pestaña de vista previa. Deberías poder ver el logo de Clementine.js. Pulsa \"sign in\" y acepta la solicitud de GitHub para autorizar la aplicación.", - "" - ], - [ - "http://i.imgur.com/2IJfyvN.gif", - "Una imagen gif que te muestra cómo pulsar un botón para desencadenar una acción AJAX con Clementine.js y cómo ver tu perfil de usuario en los datos de autenticación provistos por GitHub.", - "Pulsa el botón que dice \"click me\" y verás que se incrementa el número de clics. Pulsa el botón de perfil (profile) y verás la información de tu perfil de GitHub.", - "" - ], - [ - "http://i.imgur.com/bjO5pnq.gif", - "Una imagen gif que te muestra cómo crear un nuevo repositorio de GitHub GitHub y empujar allí tu código.", - "Crea un nuevo repositorio en GitHub. Luego copia su ULR .git.
Regresa a tu terminal de c9.io y establece tu URL remota de GitHub: git remote set-url origin seguido de la URL que copiaste de GitHub.
Ejecuta git push origin master.
Ahora ve de regreso a la página de GitHub y actualízala. Verás que tu código ahora está ahora en GitHub.", - "https://github.com/new" - ], - [ - "http://i.imgur.com/Qn0K65B.gif", - "Una imagen gif que te muestra cómo agregar complementos a Heroku.", - "Pronto agregaremos instrucciones para hacer que Clementine corra en Heroku. Por ahora, desarrolla tus Basejumps en c9.io.", - "" - ] - ], - "namePt": "", - "descriptionPt": [] - }, { "id": "bd7158d8c443eddfaeb5bdef", "title": "Build a Voting App", @@ -199,8 +10,6 @@ "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: http://votingapp.herokuapp.com/ and deploy it to Heroku.", "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", - "As you build your app, you should frequently commit changes to your codebase. You can do this by running git commit -am \"your commit message\". Note that you should replace \"your commit message\" with a brief summary of the changes you made to your code.", - "You can push these new commits to GitHub by running git push origin master, and to Heroku by running grunt --force && grunt buildcontrol:heroku.", "Here are the specific user stories you should implement for this Basejump:", "User Story: As an authenticated user, I can keep my polls and come back later to access them.", "User Story: As an authenticated user, I can share my polls with my friends.", @@ -210,7 +19,7 @@ "User Story: As an unauthenticated or authenticated user, I can see and vote on everyone's polls.", "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.)", "User Story: As an authenticated user, if I don't like the options on a poll, I can create a new option.", - "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.", + "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.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", @@ -250,15 +59,13 @@ "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: http://whatsgoinontonight.herokuapp.com/ and deploy it to Heroku.", "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", - "As you build your app, you should frequently commit changes to your codebase. You can do this by running git commit -am \"your commit message\". Note that you should replace \"your commit message\" with a brief summary of the changes you made to your code.", - "You can push these new commits to GitHub by running git push origin master, and to Heroku by running grunt --force && grunt buildcontrol:heroku.", "Here are the specific user stories you should implement for this Basejump:", "User Story: As an unauthenticated user, I can view all bars in my area.", "User Story: As an authenticated user, I can add myself to a bar to indicate I am going there tonight.", "User Story: As an authenticated user, I can remove myself from a bar if I no longer want to go there.", "User Story: As an unauthenticated user, when I login I should not have to search again.", "Hint: Try using the Yelp API to find venues in the cities your users search for. If you use Yelp's API, be sure to mention so in your app.", - "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.", + "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.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", @@ -295,14 +102,12 @@ "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: http://stockstream.herokuapp.com/ and deploy it to Heroku.", "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", - "As you build your app, you should frequently commit changes to your codebase. You can do this by running git commit -am \"your commit message\". Note that you should replace \"your commit message\" with a brief summary of the changes you made to your code.", - "You can push these new commits to GitHub by running git push origin master, and to Heroku by running grunt --force && grunt buildcontrol:heroku.", "Here are the specific user stories you should implement for this Basejump:", "User Story: I can view a graph displaying the recent trend lines for each added stock.", "User Story: I can add new stocks by their symbol name.", "User Story: I can remove stocks.", "User Story: I can see changes in real-time when any other user adds or removes a stock. For this you will need to use Web Sockets.", - "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.", + "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.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", @@ -338,14 +143,12 @@ "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: http://bookjump.herokuapp.com/ and deploy it to Heroku.", "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", - "As you build your app, you should frequently commit changes to your codebase. You can do this by running git commit -am \"your commit message\". Note that you should replace \"your commit message\" with a brief summary of the changes you made to your code.", - "You can push these new commits to GitHub by running git push origin master, and to Heroku by running grunt --force && grunt buildcontrol:heroku.", "Here are the specific user stories you should implement for this Basejump:", "User Story: I can view all books posted by every user.", "User Story: I can add a new book.", "User Story: I can update my settings to store my full name, city, and state.", "User Story: I can propose a trade and wait for the other user to accept the trade.", - "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.", + "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.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", @@ -381,8 +184,6 @@ "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: http://stark-lowlands-3680.herokuapp.com/ and deploy it to Heroku.", "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", - "As you build your app, you should frequently commit changes to your codebase. You can do this by running git commit -am \"your commit message\". Note that you should replace \"your commit message\" with a brief summary of the changes you made to your code.", - "You can push these new commits to GitHub by running git push origin master, and to Heroku by running grunt --force && grunt buildcontrol:heroku.", "Here are the specific user stories you should implement for this Basejump:", "User Story: As an unauthenticated user, I can login with Twitter.", "User Story: As an authenticated user, I can link to images.", @@ -391,7 +192,7 @@ "User Story: As an unauthenticated user, I can browse other users' walls of images.", "User Story: As an authenticated user, if I upload an image that is broken, it will be replaced by a placeholder image. (can use jQuery broken image detection)", "Hint: Masonry.js is a library that allows for Pinterest-style image grids.", - "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.", + "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.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "basejump", From 9d1cb86dff89ff64f414ddda063f8c0aba8bd1f8 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Mon, 28 Dec 2015 00:39:17 -0600 Subject: [PATCH 007/174] start adding new challenges and resequence existing ziplines --- .../basic-bonfires.json | 4 +- .../basic-ziplines.json | 108 ++++++---- .../intermediate-ziplines.json | 203 +++++++++--------- .../data-visualization-projects.json | 133 +++++++++--- .../react-projects.json | 133 +++++++++--- .../api-projects.json | 1 - 6 files changed, 372 insertions(+), 210 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-bonfires.json b/seed/challenges/01-front-end-development-certification/basic-bonfires.json index 11560772d6..fef250af1c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-bonfires.json +++ b/seed/challenges/01-front-end-development-certification/basic-bonfires.json @@ -27,8 +27,8 @@ "" ], [ - "http://i.imgur.com/5pAl7TV.jpg", - "A beagle winking and pointing his paw at you.", + "http://i.imgur.com/p2TpOQd.jpg", + "A cute dog jumping over a hurdle and winking and pointing his paw at you.", "When you get stuck, just use the Read-Search-Ask methodology.
Don't worry - you've got this.", "" ] diff --git a/seed/challenges/01-front-end-development-certification/basic-ziplines.json b/seed/challenges/01-front-end-development-certification/basic-ziplines.json index dd30b7cd84..f3bd88501e 100644 --- a/seed/challenges/01-front-end-development-certification/basic-ziplines.json +++ b/seed/challenges/01-front-end-development-certification/basic-ziplines.json @@ -20,6 +20,12 @@ "Ziplines are hard. It takes most campers several days to build each Zipline. You will get frustrated. But don't quit. This gets easier with practice.", "" ], + [ + "http://i.imgur.com/p2TpOQd.jpg", + "A cute dog jumping over a hurdle and winking and pointing his paw at you.", + "When you get stuck, just use the Read-Search-Ask methodology.
Don't worry - you've got this.", + "" + ], [ "http://i.imgur.com/6WLULsC.gif", "A gif showing how to create a Codepen account.", @@ -99,7 +105,9 @@ { "id": "bd7158d8c242eddfaeb5bd13", "title": "Build a Personal Portfolio Webpage", - "challengeSeed": ["133315782"], + "challengeSeed": [ + "133315782" + ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", @@ -159,14 +167,16 @@ "Recuerda utilizar Read-Search-Ask si te sientes atascado.", "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], + ], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c442eddfaeb5bd13", "title": "Build a Random Quote Machine", - "challengeSeed": ["126415122"], + "challengeSeed": [ + "126415122" + ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/AdventureBear/full/vEoVMw.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", @@ -210,14 +220,59 @@ "Recuerda utilizar Read-Search-Ask si te sientes atascado.", "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], + ], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "bd7158d8c442eddfaeb5bd17", + "title": "Build a JavaScript Calculator", + "challengeSeed": [ + "126411565" + ], + "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/zxgaqw.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can add, subtract, multiply and divide two numbers.", + "User Story: I can clear the input field with a clear button.", + "User Story: I can keep chaining mathematical operations together until I hit the equal button, and the calculator will tell me the correct output.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." + ], + "type": "zipline", + "challengeType": 3, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "Crea una calculadora JavaScript", + "descriptionEs": [ + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/zxgaqw.", + "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", + "Regla #2: Puedes usar cualquier librería o APIs que necesites.", + "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", + "Las siguientes son las historias de usuario que debes satisfacer, incluyendo las historias opcionales:", + "Historia de usuario: Como usuario, puedo sumar, restar, multiplicar y dividir dos números.", + "Historia de usuario opcional: Puedo limpiar la pantalla con un botón de borrar.", + "Historia de usuario opcional: Puedo concatenar continuamente varias operaciones hasta que pulse el botón de igual, y la calculadora me mostrará la respuesta correcta.", + "Recuerda utilizar Read-Search-Ask si te sientes atascado.", + "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", + "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" + ], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c442eddfaeb5bd0f", "title": "Build a Pomodoro Clock", - "challengeSeed": ["126411567"], + "challengeSeed": [ + "126411567" + ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/RPbGxZ/.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", @@ -263,50 +318,9 @@ "Recuerda utilizar Read-Search-Ask si te sientes atascado.", "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7158d8c442eddfaeb5bd17", - "title": "Build a JavaScript Calculator", - "challengeSeed": ["126411565"], - "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/zxgaqw.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", - "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can add, subtract, multiply and divide two numbers.", - "User Story: I can clear the input field with a clear button.", - "User Story: I can keep chaining mathematical operations together until I hit the equal button, and the calculator will tell me the correct output.", - "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. ", - "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], - "type": "zipline", - "challengeType": 3, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "Crea una calculadora JavaScript", - "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/zxgaqw.", - "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", - "Regla #2: Puedes usar cualquier librería o APIs que necesites.", - "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", - "Las siguientes son las historias de usuario que debes satisfacer, incluyendo las historias opcionales:", - "Historia de usuario: Como usuario, puedo sumar, restar, multiplicar y dividir dos números.", - "Historia de usuario opcional: Puedo limpiar la pantalla con un botón de borrar.", - "Historia de usuario opcional: Puedo concatenar continuamente varias operaciones hasta que pulse el botón de igual, y la calculadora me mostrará la respuesta correcta.", - "Recuerda utilizar Read-Search-Ask si te sientes atascado.", - "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", - "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], "namePt": "", "descriptionPt": [] } ] -} +} \ No newline at end of file diff --git a/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json b/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json index 42548be680..afdc2bcb00 100644 --- a/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json +++ b/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json @@ -6,7 +6,9 @@ { "id": "bd7158d8c442eddfaeb5bd10", "title": "Show the Local Weather", - "challengeSeed": ["126415127"], + "challengeSeed": [ + "126415127" + ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/avqvgJ.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", @@ -56,21 +58,113 @@ "Recuerda utilizar Read-Search-Ask si te sientes atascado.", "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], + ], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "bd7158d8c442eddfaeb5bd18", + "title": "Stylize Stories on Camper News", + "challengeSeed": [ + "126415129" + ], + "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/MarufSarker/full/ZGPZLq/.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can browse recent posts from Camper News.", + "User Story: I can click on a post to be taken to the story's original URL.", + "User Story: I can see how many upvotes each story has.", + "Hint: Here's the Camper News Hot Stories API endpoint: http://www.freecodecamp.com/news/hot.", + "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.", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." + ], + "type": "zipline", + "challengeType": 3, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "Adorna las noticias de Camper News", + "descriptionEs": [ + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/MarufSarker/full/ZGPZLq/.", + "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", + "Regla #2: Puedes usar cualquier librería o APIs que necesites.", + "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", + "Las siguientes son las historias de usuario que debes satisfacer, incluyendo las historias opcionales:", + "Historia de usuario: Como usuario, puedo navegar las publicaciones recientes de Camper News.", + "Historia de usuario: Como usuario, puedo pulsar en una publicación y ser llevado al URL original de la historia.", + "Historia de usuario opcional: Como usuario, puedo ver cuántos votos tiene cada historia.", + "Pista: Este es el endpoint del API de Noticias calientes de Camper News: http://www.freecodecamp.com/news/hot.", + "Recuerda utilizar Read-Search-Ask si te sientes atascado.", + "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", + "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" + ], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "bd7158d8c442eddfaeb5bd19", + "title": "Build a Wikipedia Viewer", + "challengeSeed": [ + "126415131" + ], + "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/MwgQea.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can search Wikipedia entries in a search box and see the resulting Wikipedia entries.", + "User Story: I can click a button to see a random Wikipedia entry.", + "User Story: When I type in the search box, I can see a dropdown menu with autocomplete options for matching Wikipedia entries.", + "Hint: Here's an entry on using Wikipedia's API: http://www.mediawiki.org/wiki/API:Main_page.", + "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.", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." + ], + "type": "zipline", + "challengeType": 3, + "tests": [], + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "Crea un buscador de Wikipedia", + "descriptionEs": [ + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/MwgQea.", + "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", + "Regla #2: Puedes usar cualquier librería o APIs que necesites.", + "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", + "Las siguientes son las historias de usuario que debes satisfacer, incluyendo las historias opcionales:", + "Historia de usuario: Como usuario, puedo hacer una búsqueda a la base de datos de Wikipedia en una caja de búsqueda y ver los artículos resultantes.", + "Historia de usuario opcional:Como usuario, puedo pulsar un botón para ver un artículo aleatorio de Wikipedia.", + "Historia de usuario opcional:Como usuario, cuando escribo en la caja de búsqueda, puedo ver un menú desplegable con opciones de autocompletar referentes a artículos similares de Wikipedia.", + "Pista: Esta es un artículo muy útil relativo al uso del API de Wikipedia: http://www.mediawiki.org/wiki/API:Main_page.", + "Recuerda utilizar Read-Search-Ask si te sientes atascado.", + "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", + "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" + ], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c442eddfaeb5bd1f", "title": "Use the Twitch.tv JSON API", - "challengeSeed": ["126411564"], + "challengeSeed": [ + "126411564" + ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/GJKRxZ.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can see whether Free Code Camp is currently streaming on Twitch.tv.", "User Story: I can click the status output and be sent directly to the Free Code Camp's Twitch.tv channel.", - "User Story: if Free Code Camp is streaming, I can see additional details about what they are streaming.", + "User Story: if a Twitch user is currently streaming, I can see additional details about what they are streaming.", "User Story: I will see a placeholder notification if a streamer has closed their Twitch account. You can verify this works by adding brunofin and comster404 to your array of Twitch streamers.", "Hint: See an example call to Twitch.tv's JSONP API at https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Zipline-Use-the-Twitchtv-JSON-API.", "Hint: The relevant documentation about this API call is here: https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streamschannel.", @@ -123,101 +217,16 @@ "Recuerda utilizar Read-Search-Ask si te sientes atascado.", "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], - "namePt": "", - "descriptionPt": [] - }, - { - - "id": "bd7158d8c442eddfaeb5bd18", - "title": "Stylize Stories on Camper News", - "challengeSeed": ["126415129"], - "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/MarufSarker/full/ZGPZLq/.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", - "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can browse recent posts from Camper News.", - "User Story: I can click on a post to be taken to the story's original URL.", - "User Story: I can see how many upvotes each story has.", - "Hint: Here's the Camper News Hot Stories API endpoint: http://www.freecodecamp.com/news/hot.", - "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.", - "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], - "type": "zipline", - "challengeType": 3, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "Adorna las noticias de Camper News", - "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/MarufSarker/full/ZGPZLq/.", - "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", - "Regla #2: Puedes usar cualquier librería o APIs que necesites.", - "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", - "Las siguientes son las historias de usuario que debes satisfacer, incluyendo las historias opcionales:", - "Historia de usuario: Como usuario, puedo navegar las publicaciones recientes de Camper News.", - "Historia de usuario: Como usuario, puedo pulsar en una publicación y ser llevado al URL original de la historia.", - "Historia de usuario opcional: Como usuario, puedo ver cuántos votos tiene cada historia.", - "Pista: Este es el endpoint del API de Noticias calientes de Camper News: http://www.freecodecamp.com/news/hot.", - "Recuerda utilizar Read-Search-Ask si te sientes atascado.", - "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", - "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7158d8c442eddfaeb5bd19", - "title": "Build a Wikipedia Viewer", - "challengeSeed": ["126415131"], - "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/MwgQea.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", - "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can search Wikipedia entries in a search box and see the resulting Wikipedia entries.", - "User Story: I can click a button to see a random Wikipedia entry.", - "User Story: When I type in the search box, I can see a dropdown menu with autocomplete options for matching Wikipedia entries.", - "Hint: Here's an entry on using Wikipedia's API: http://www.mediawiki.org/wiki/API:Main_page.", - "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.", - "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." - ], - "type": "zipline", - "challengeType": 3, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "Crea un buscador de Wikipedia", - "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/MwgQea.", - "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", - "Regla #2: Puedes usar cualquier librería o APIs que necesites.", - "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", - "Las siguientes son las historias de usuario que debes satisfacer, incluyendo las historias opcionales:", - "Historia de usuario: Como usuario, puedo hacer una búsqueda a la base de datos de Wikipedia en una caja de búsqueda y ver los artículos resultantes.", - "Historia de usuario opcional:Como usuario, puedo pulsar un botón para ver un artículo aleatorio de Wikipedia.", - "Historia de usuario opcional:Como usuario, cuando escribo en la caja de búsqueda, puedo ver un menú desplegable con opciones de autocompletar referentes a artículos similares de Wikipedia.", - "Pista: Esta es un artículo muy útil relativo al uso del API de Wikipedia: http://www.mediawiki.org/wiki/API:Main_page.", - "Recuerda utilizar Read-Search-Ask si te sientes atascado.", - "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", - "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c442eedfaeb5bd1c", "title": "Build a Tic Tac Toe Game", - "challengeSeed": ["126415123"], + "challengeSeed": [ + "126415123" + ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/alex-dixon/full/JogOpQ/.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", @@ -253,14 +262,16 @@ "Recuerda utilizar Read-Search-Ask si te sientes atascado.", "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], + ], "namePt": "", "descriptionPt": [] }, { "id": "bd7158d8c442eddfaeb5bd1c", "title": "Build a Simon Game", - "challengeSeed": ["137213633"], + "challengeSeed": [ + "137213633" + ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/dting/full/QbRyqq/.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", @@ -308,9 +319,9 @@ "Recuerda utilizar Read-Search-Ask si te sientes atascado.", "Cuando hayas terminado, pulsa el botón de \"I've completed this challenge\" e incluye un link a tu CodePen. Si programaste en pareja, debes incluir también el nombre de usuario de Free Code Camp de tu compañero.", "Si quieres retroalimentación inmediata de parte de tus compañeros campistas, pulsa este botón y pega el link de tu proyecto en CodePen.

Pulsa aquí y agrega tu link en el texto del tweet" - ], + ], "namePt": "", "descriptionPt": [] } ] -} +} \ No newline at end of file diff --git a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json index 66fee45fe1..b5fafceb92 100644 --- a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json +++ b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json @@ -1,14 +1,28 @@ { "name": "Data Visualization Projects", "order": 17, - "isComingSoon": true, "time": "200h", "challenges": [ { - "id": "bd7158d8c443ede2aeb5bdef", - "title": "Data Visualization Project 1", - "challengeSeed": [], + "id": "bd7168d8c242eddfaeb5bd13", + "title": "", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -19,17 +33,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea una aplicación de votaciones", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede2aeb5bdff", - "title": "Data Visualization Project 2", - "challengeSeed": [], + "id": "bd7178d8c242eddfaeb5bd13", + "title": "", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -40,17 +68,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea una aplicación de coordinación de vida nocturna", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede2aeb5bd0e", - "title": "Data Visualization Project 3", - "challengeSeed": [], + "id": "bd7188d8c242eddfaeb5bd13", + "title": "", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -61,17 +103,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Grafica el mercado de acciones", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede2aeb5bd0f", - "title": "Data Visualization Project 4", - "challengeSeed": [], + "id": "bd7198d8c242eddfaeb5bd13", + "title": "", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -82,17 +138,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Administra un club de intercambio de libros", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede2aeb5bdee", - "title": "Data Visualization Project 5", - "challengeSeed": ["133315784"], + "id": "bd7108d8c242eddfaeb5bd13", + "title": "", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -103,11 +173,10 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea un clon de Pinterest", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] } ] -} +} \ No newline at end of file diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index 7e3ba502e8..1f2031de12 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -1,14 +1,28 @@ { "name": "React Projects", "order": 15, - "isComingSoon": true, "time": "200h", "challenges": [ { - "id": "bd7158d8c443ede1aeb5bdef", - "title": "React Project 1", - "challengeSeed": [], + "id": "bd7157d8c242eddfaeb5bd13", + "title": "Build a Markdown Previewer", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -19,17 +33,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea una aplicación de votaciones", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede1aeb5bdff", - "title": "React Project 2", - "challengeSeed": [], + "id": "bd7156d8c242eddfaeb5bd13", + "title": "Build an Camper Leaderboard", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -40,17 +68,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea una aplicación de coordinación de vida nocturna", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede1aeb5bd0e", - "title": "React Project 3", - "challengeSeed": [], + "id": "bd7155d8c242eddfaeb5bd13", + "title": "Build a Recipe Box", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -61,17 +103,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Grafica el mercado de acciones", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede1aeb5bd0f", - "title": "React Project 4", - "challengeSeed": [], + "id": "bd7154d8c242eddfaeb5bd13", + "title": "Build the Conway Game of Life", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -82,17 +138,31 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Administra un club de intercambio de libros", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] }, { - "id": "bd7158d8c443ede1aeb5bdee", - "title": "React Project 5", - "challengeSeed": ["133315784"], + "id": "bd7153d8c242eddfaeb5bd13", + "title": "Build a Roguelike Dungeon Crawler Game", + "challengeSeed": [ + "133315782" + ], "description": [ + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", + "User Story: I can access all of the portfolio webpage's content just by scrolling.", + "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", + "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", + "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", + "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", + "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", + "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. ", + "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", "challengeType": 3, @@ -103,11 +173,10 @@ "descriptionFr": [], "nameRu": "", "descriptionRu": [], - "nameEs": "Crea un clon de Pinterest", - "descriptionEs": [ - ], + "nameEs": "", + "descriptionEs": [], "namePt": "", "descriptionPt": [] } ] -} +} \ No newline at end of file diff --git a/seed/challenges/03-back-end-development-certification/api-projects.json b/seed/challenges/03-back-end-development-certification/api-projects.json index be7b9661d9..edfb4b5b99 100644 --- a/seed/challenges/03-back-end-development-certification/api-projects.json +++ b/seed/challenges/03-back-end-development-certification/api-projects.json @@ -1,7 +1,6 @@ { "name": "API Projects", "order": 26, - "isComingSoon": true, "time": "100h", "challenges": [ { From 25214a345649047a4ceecd0a34aa8a8fa9870daa Mon Sep 17 00:00:00 2001 From: Robert Richey Date: Mon, 28 Dec 2015 00:11:00 -0700 Subject: [PATCH 008/174] Update waypoint description and test Waypoint: Add Rounded Corners with a Border Radius description now explains multiple solutions are possible. Second test case updated to match the string '10px' instead of a parsed integer value greater than 8. closes #5467 --- .../01-front-end-development-certification/html5-and-css.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/html5-and-css.json b/seed/challenges/01-front-end-development-certification/html5-and-css.json index cafeb37b85..1661251698 100644 --- a/seed/challenges/01-front-end-development-certification/html5-and-css.json +++ b/seed/challenges/01-front-end-development-certification/html5-and-css.json @@ -1028,8 +1028,8 @@ "title": "Add Rounded Corners with a Border Radius", "description": [ "Your cat photo currently has sharp corners. We can round out those corners with a CSS property called border-radius.", - "You can specify a border-radius with pixels. This will affect how rounded the corners are. Add this property to your thick-green-border class and set it to 10px.", - "Give your cat photo a border-radius of 10px." + "You can specify a border-radius with pixels. Give your cat photo a border-radius of 10px.", + "Note: this waypoint allows for multiple possible solutions. For example, you may add border-radius to either the .thick-green-border class or .smaller-image class." ], "tests": [ "assert($(\"img\").hasClass(\"thick-green-border\"), 'message: Your image element should have the class \"thick-green-border\".');", From b8e7d2b4038d91011df02745170d8f5c2d5e8141 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 21 Dec 2015 09:27:04 -0800 Subject: [PATCH 009/174] New challenge specific CSS --- client/less/challenge.less | 23 +++++++++++++++++++++++ client/less/main.less | 1 + 2 files changed, 24 insertions(+) create mode 100644 client/less/challenge.less diff --git a/client/less/challenge.less b/client/less/challenge.less new file mode 100644 index 0000000000..06f40ee4b3 --- /dev/null +++ b/client/less/challenge.less @@ -0,0 +1,23 @@ +.bonfire-instructions h4 { + margin-bottom: 0px; +} + +.bonfire-instructions blockquote { + font-size: 90%; + font-family: @font-family-monospace; + color: @code-color; + background-color: @code-bg; + border-radius: @border-radius-base; + border: 1px solid @pre-border-color; + white-space: pre; + padding: 5px 10px; + margin-bottom: 5px; + overflow: auto; +} + +.bonfire-instructions dfn { + font-family: @font-family-monospace; + color: @code-color; + background-color: @code-bg; + border-radius: @border-radius-base; +} diff --git a/client/less/main.less b/client/less/main.less index 93d8d84a96..69679ccbe2 100644 --- a/client/less/main.less +++ b/client/less/main.less @@ -1137,3 +1137,4 @@ code { @import "chat.less"; @import "jobs.less"; +@import "challenge.less"; From acd7c20865e59d72f4c533eefd774aeb26f10bdd Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 21 Dec 2015 09:26:28 -0800 Subject: [PATCH 010/174] New and Updated Javascript Challenges --- .../basic-javascript.json | 4422 +++++++++++++---- 1 file changed, 3563 insertions(+), 859 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index f346831d08..4818cf354a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1,6 +1,6 @@ { "name": "Basic JavaScript", - "order": 6, + "order": "6", "time": "5h", "challenges": [ { @@ -13,26 +13,15 @@ "// 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." + "

Instructions

Try creating one of each type of comment." ], "tests": [ "assert(editor.getValue().match(/(\\/\\/)...../g), 'message: Create a // style comment that contains at least five letters.');", "assert(editor.getValue().match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'message: Create a /* */ style comment that contains at least five letters.');", "assert(editor.getValue().match(/(\\*\\/)/g), 'message: Make sure that you close the comment with a */.');" ], - "challengeSeed": [], "type": "waypoint", - "challengeType": 1, - "nameEs": "Agrega comentarios a tu código JavaScript", - "descriptionEs": [ - "Los comentarios son líneas de código que el computador ignorará intencionalmente. Los comentarios son una gran forma de dejarte notas a ti mismo y a otras personas que luego tendrán que averiguar lo que hace que el código. ", - "Vamos a echar un vistazo a las dos maneras en las que puedes agregar tus comentarios en JavaScript.", - "El comentario de doble barra comentará el resto del texto en la línea donde se ubica:", - "// Este es un comentario.", - "El comentario de barra-estrella-estrella-barra, comentará todo lo que haya entre los caracteres /* y */:", - "/* Este es también un comentario */", - "Trata de crear uno de cada uno." - ] + "challengeType": "1" }, { "id": "bd7123c9c441eddfaeb5bdef", @@ -40,10 +29,10 @@ "description": [ "In computer science, data structures are things that hold data. JavaScript has seven of these. For example, the Number data structure holds numbers.", "Let's learn about the most basic data structure of all: the Boolean. Booleans can only hold the value of either true or false. They are basically little on-off switches.", - "Let's modify our welcomeToBooleans function so that it will return true instead of false when the run button is clicked." + "

Instructions

Modify the welcomeToBooleans function so that it will return true instead of false when the run button is clicked." ], "tests": [ - "assert(typeof welcomeToBooleans() === 'boolean', 'message: The welcomeToBooleans() function should return a boolean (true/false) value.');", + "assert(typeof(welcomeToBooleans()) === 'boolean', 'message: The welcomeToBooleans() function should return a boolean (true/false) value.');", "assert(welcomeToBooleans() === true, 'message: welcomeToBooleans() should return true.');" ], "challengeSeed": [ @@ -51,7 +40,7 @@ "", "// Only change code below this line.", "", - " return false;", + " return false; // Change this line", "", "// Only change code above this line.", "}" @@ -60,13 +49,7 @@ "welcomeToBooleans();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Entiende los valores booleanos", - "descriptionEs": [ - "En informática las estructuras de datos son cosas que contienen datos. JavaScript tiene siete de estas. Por ejemplo, la estructura de datos Número contiene números. ", - "Vamos a aprender acerca de la estructura de datos más básica de todas: el Boolean. Los booleanos sólo puede contener el valor verdadero o el valor falso. Son básicamente pequeños interruptores de encendido y apagado. ", - "Vamos a modificar nuestra función welcomeToBooleans para que devuelva true en lugar de false cuando se pulse el botón de ejecución." - ] + "challengeType": "1" }, { "id": "bd7123c9c443eddfaeb5bdef", @@ -75,249 +58,199 @@ "When we store data in a data structure, we call it a variable. These variables are no different from the x and y variables you use in math.", "Let's create our first variable and call it \"myName\".", "You'll notice that in myName, we didn't use a space, and that the \"N\" is capitalized. JavaScript variables are written in camel case. An example of camel case is: camelCase.", - "Now, use the var keyword to create a variable called myName. Set its value to your name, in double quotes.", + "

Instructions

Use the var keyword to create a variable called myName. Set its value to your name, in double quotes.", + "Hint", "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;}})(), 'message: 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;}})(), 'message: myName should be a string that contains at least one character in it.');" ], "challengeSeed": [ + "// Example", "var ourName = \"Free Code Camp\";", "", + "// Only change code below this line", "" ], "tail": [ - "if(typeof myName !== \"undefined\"){(function(v){return v;})(myName);}" + "if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Declara variables en JavaScript", - "descriptionEs": [ - "Cuando almacenamos datos en una estructura de datos, la llamamos una variable. Estas variables no son diferentes de las variables x e y que utilizas en matemáticas. ", - "Vamos a crear nuestra primera variable y a llamarla \"myName\".", - "Te darás cuenta que en myName, no usamos un espacio, y que la \" N\"se escribe con mayúscula. Las variables en JavaScript se escriben con capitalización camello (camel case). Un ejemplo de capitalización camello: capitalizacionCamello.", - "Ahora, utiliza la palabra clave var para crear una variable llamada myName. Establecele como valor tu nombre, entre comillas dobles. ", - "Mira el ejemplo con ourName si te quedas atascado." - ] + "challengeType": "1" }, { - "id": "bd7123c9c444eddfaeb5bdef", - "title": "Declare String Variables", + "id": "56533eb9ac21ba0edf2244a8", + "title": "Storing Values with the Equal Operator", "description": [ - "In the previous challenge, we used the code var myName = \"your name\". This is what we call a String variable. It is nothing more than a \"string\" of characters. JavaScript strings are always wrapped in quotes.", - "Now let's create two new string variables: myFirstName and myLastName and assign them the values of your first and last name, respectively." + "In Javascript, you can store a value in a variable with the = or assignment operator.", + "myVariable = 5;", + "Assigns the value 5 to myVariable.", + "Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.", + "myVar = 5;", + "myNum = myVar;", + "Assigns 5 to myVar and then resolves myVar to 5 again and assigns it to myNum.", + "

Instructions

Assign the value 7 to variable a", + "Assign the contents of a to variable b." ], + "releasedOn": "11/27/2015", "tests": [ - "assert((function(){if(typeof myFirstName !== \"undefined\" && typeof myFirstName === \"string\" && myFirstName.length > 0){return true;}else{return false;}})(), 'message: 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;}})(), 'message: myLastName should be a string with at least one character in it.');" + "assert(/var a;/.test(editor.getValue()) && /var b = 2;/.test(editor.getValue()), 'message: Do not change code above the line');", + "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", + "assert(typeof b === 'number' && b === 7, 'message: b should have a value of 7');", + "assert(editor.getValue().match(/b\\s*=\\s*a\\s*;/g), 'message: a should be assigned to b with =');" ], "challengeSeed": [ - "var firstName = \"Alan\";", - "var lastName = \"Turing\";", + "// Setup", + "var a;", + "var b = 2;", "", - "", - "// Only change code above this line.", - "", - "if(typeof myFirstName !== \"undefined\" && typeof myLastName !== \"undefined\"){(function(){return myFirstName + ', ' + myLastName;})();}" + "// Only change code below this line", + " " + ], + "tail": [ + "(function(a,b){return \"a = \" + a + \", b = \" + b;})(a,b);" + ], + "solutions": [ + "var a;", + "var b=2;", + "a = 7;", + "b = a;7" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Declara variables tipo cadena", - "descriptionEs": [ - "En el reto anterior, se utilizó el código myName var = \"su nombre\". Esto es lo que llamamos una variable tipo cadena. No es nada más que una \"cadena\" de caracteres. Las cadenas en JavaScript siempre se encierran entre comillas. ", - "Ahora vamos a crear dos nuevas variables tipo cadena: myFirstName y myLastName y asignarles los valores de tu nombre y tu apellido, respectivamente." - ] + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { - "id": "bd7123c9c448eddfaeb5bdef", - "title": "Check the Length Property of a String Variable", + "id": "56533eb9ac21ba0edf2244a9", + "title": "Initializing Variables with the Equal Operator", "description": [ - "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." + "It is common to initialize a variable to a starting value on the same line as it is defined.", + "", + "var myVar = 0;", + "Creates a new variable called myVar and assigns it an inital value of 0.", + "", + "

Instructions

Define a variable a with var and initialize it to a value of 9." ], + "releasedOn": "11/27/2015", "tests": [ - "assert((function(){if(typeof lastNameLength !== \"undefined\" && typeof lastNameLength === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'message: 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;}})(), 'message: You should be getting the length of lastName by using .length like this: lastName.length.');" + "assert(/var\\s+a\\s*=\\s*9\\s*/.test(editor.getValue()), 'message: Initialize a to a value of 9');" ], "challengeSeed": [ - "var firstNameLength = 0;", - "var lastNameLength = 0;", - "var firstName = \"Ada\";", + "// Example", + "var ourVar = 19;", "", - "firstNameLength = firstName.length;", - "", - "var lastName = \"Lovelace\";", - "", - "// Only change code below this line.", - "", - "lastNameLength = lastName;", - "", - "", - "", - "// Only change code above this line.", - "", - "if(typeof lastNameLength !== \"undefined\"){(function(){return lastNameLength;})();}" + "// Only change code below this line", + "" + ], + "tail": [ + "if(typeof a !== 'undefined') {(function(a){return \"a = \" + a;})(a);} else { (function() {return 'a is undefined';})(); }" + ], + "solutions": [ + "var a = 9;" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Comprueba la propiedad longitud (length) de una variable tipo cadena", - "descriptionEs": [ - "Las estructuras de datos tienen propiedades. Por ejemplo, las cadenas tienen una propiedad llamada .length que te dirá cuántos caracteres hay en la cadena.", - "Por ejemplo, si creamos una variable var firstName=\"Charles\", podemos averiguar la longitud de la cadena \"Charles\" usando la propiedad firstName.length. ", - "Usa la propiedad .length para contar el número de caracteres en el variable lastName." - ] + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { - "id": "bd7123c9c549eddfaeb5bdef", - "title": "Use Bracket Notation to Find the First Character in a String", + "id": "56533eb9ac21ba0edf2244aa", + "title": "Understanding Uninitialized Variables", "description": [ - "Bracket notation is a way to get a character at a specific index within a string.", - "Computers don't start counting at 1 like humans do. They start at 0.", - "For example, the character at index 0 in the word \"Charles\" is \"C\". So if var firstName = \"Charles\", you can get the value of the first letter of the string by using firstName[0].", - "Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", - "Try looking at the firstLetterOfFirstName variable declaration if you get stuck." + "When Javascript variables are declared, they have an inital value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatanate a string with an undefined variable, you will get a literal string of \"undefined\".", + "

Instructions

Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." ], + "releasedOn": "11/27/2015", "tests": [ - "assert((function(){if(typeof firstLetterOfLastName !== \"undefined\" && editor.getValue().match(/\\[0\\]/gi) && typeof firstLetterOfLastName === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" + "assert(typeof a === 'number' && a === 6, 'message: a should be defined and have a value of 6');", + "assert(typeof b === 'number' && b === 15, 'message: b should be defined and have a value of 15');", + "assert(!/undefined/.test(c) && c === \"I am a String!\", 'message: c should not contain undefined and should have a value of \"I am a String!\"');", + "assert(/a = a \\+ 1;/.test(editor.getValue()) && /b = b \\+ 5;/.test(editor.getValue()) && /c = c \\+ \" String!\";/.test(editor.getValue()), 'message: Do not change code below the line');" ], "challengeSeed": [ - "var firstLetterOfFirstName = \"\";", - "var firstLetterOfLastName = \"\";", + "// Initialize these three variables", + "var a;", + "var b;", + "var c;", "", - "var firstName = \"Ada\";", + "// Do not change code below this line", "", - "firstLetterOfFirstName = firstName[0];", - "", - "var lastName = \"Lovelace\";", - "", - "firstLetterOfLastName = lastName;", - "", - "", - "// Only change code above this line.", - "", - "(function(v){return v;})(firstLetterOfLastName);" + "a = a + 1;", + "b = b + 5;", + "c = c + \" String!\";", + "" + ], + "tail": [ + "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" + ], + "solutions": [ + "var a = 5;", + "var b = 10;", + "var c = \"I am a\";", + "a = a + 1;", + "b = b + 5;", + "c = c + \" String!\";" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Usa la notación de corchetes para encontrar el primer acaracter de una cadena", - "descriptionEs": [ - "La notación de corchetes es una forma de obtener el caracter en un índice específico de una cadena.", - "Los computadoras no empiezan a contar desde 1 como hacen los humanos. Comienzan en 0 ", - "Por ejemplo, el caracter en el índice 0 en la palabra \"Charles \" es \"C\". Entonces si var firstName = \"Charles\", puedes obtener la primera letra de la cadena usando firstName[0] .", - "Usa la notación de corchetes para encontrar el primer caracter en la variable lastName y asignarlo a firstLetterOfLastName.", - "Si te atascas intenta mirar la declaración de la variable firstLetterOfFirstName." - ] + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { - "id": "bd7123c9c450eddfaeb5bdef", - "title": "Use Bracket Notation to Find the Nth Character in a String", + "id": "56533eb9ac21ba0edf2244ab", + "title": "Understanding Case Sensitivity in Variables", "description": [ - "You can also use bracket notation to get the character at other positions within a string.", - "Remember that computers start counting at 0, so the first character is actually the zeroth character.", - "Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", - "Try looking at the secondLetterOfFirstName variable declaration if you get stuck." + "In Javascript all variables and function names are case sensitive. This means that capitalization matters.", + "MYVAR is not the same as MyVar nor myvar. It is possible to have mulitpe distinct variables with the same name but different capitalization. It is strongly reccomended that for sake of clarity you do not use this language feature.", + "

Best Practice

Variables in Javascript should use camelCase. In camelCase, variables made of multiple words have the first word in all lowercase and the first letter of each subsequent word capitalized.
", + "Examples:
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", + "

Instructions

Correct the variable assignements so their names match their variable declarations above." ], + "releasedOn": "11/27/2015", "tests": [ - "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');" + "assert(StUdLyCapVaR === 10, 'message: StUdLyCapVaR has the correct case');", + "assert(properCamelCase === \"A String\", 'message: properCamelCase has the correct case');", + "assert(TitleCaseOver === 9000, 'message: TitleCaseOver has the correct case');" ], "challengeSeed": [ - "var firstName = \"Ada\";", + "// Setup", + "var StUdLyCapVaR;", + "var properCamelCase;", + "var TitleCaseOver;", "", - "var secondLetterOfFirstName = firstName[1];", + "// Only change code below this line", "", - "var lastName = \"Lovelace\";", + "STUDLYCAPVAR = 10;", + "PRoperCAmelCAse = \"A String\";", + "tITLEcASEoVER = 9000;", + "" + ], + "solutions": [ + "var StUdLyCapVaR;", + "var properCamelCase;", + "var TitleCase;", "", - "var thirdLetterOfLastName = lastName;", - "", - "", - "// Only change code above this line.", - "", - "(function(v){return v;})(thirdLetterOfLastName);" + "StUdLyCapVaR = 10;", + "properCamelCase = \"A String\";", + "TitleCaseOver = \"9000\";" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Usa la notación de corchetes para encontrar el n-ésimo caracter en una cadena", - "descriptionEs": [ - "También puede usar notación de corchetes para obtener el caracter en otras posiciones dentro de una cadena.", - "Recuerda que los computadores empiezan a contar a 0, por lo que el primer caracter es en realidad el caracter cero.", - "Vamos a tratar de asignar a thirdLetterOfLastName la tercera letra de la variable lastName.", - "Si te atascas intenta mirar la declaración de la variable secondLetterOfFirstName." - ] - }, - { - "id": "bd7123c9c451eddfaeb5bdef", - "title": "Use Bracket Notation to Find the Last Character in a String", - "description": [ - "In order to get the last letter of a string, you can subtract one from the string's length.", - "For example, if var firstName = \"Charles\", you can get the value of the last letter of the string by using firstName[firstName.length - 1].", - "Use bracket notation to find the last character in the lastName variable.", - "Try looking at the lastLetterOfFirstName variable declaration if you get stuck." - ], - "tests": [ - "assert(lastLetterOfLastName === \"e\", 'message: lastLetterOfLastName should be \"e\".');", - "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use .length to get the last letter.');" - ], - "challengeSeed": [ - "var firstName = \"Ada\";", - "", - "var lastLetterOfFirstName = firstName[firstName.length - 1];", - "", - "var lastName = \"Lovelace\";", - "", - "var lastLetterOfLastName = lastName;", - "", - "", - "// Only change code above this line.", - "", - "(function(v){return v;})(lastLetterOfLastName);" - ], - "type": "waypoint", - "challengeType": 1, - "nameEs": "Usa notación de corchetes para encontrar el último caracter de una cadena", - "descriptionEs": [ - "Con el fin de conseguir la última letra de una cadena, puedes restar uno a la longitud de la cadena.", - "Por ejemplo, si var firstName = \"Charles\", se puede obtener la última letra usando firstName[firstName.length - 1]. ", - "Utiliza notación de corchetes para encontrar el último caracter de la variabel lastName.", - "Si te atascas intenta mirando la declaración de la variable lastLetterOfFirstName." - ] - }, - { - "id": "bd7123c9c452eddfaeb5bdef", - "title": "Use Bracket Notation to Find the Nth-to-Last Character in a String", - "description": [ - "You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.", - "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 thirdToLastLetterOfFirstName variable declaration if you get stuck." - ], - "tests": [ - "assert(secondToLastLetterOfLastName === 'c', 'message: secondToLastLetterOfLastName should be \"c\".');", - "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use .length to get the second last letter.');" - ], - "challengeSeed": [ - "var firstName = \"Ada\";", - "", - "var thirdToLastLetterOfFirstName = firstName[firstName.length - 3];", - "", - "var lastName = \"Lovelace\";", - "", - "var secondToLastLetterOfLastName = lastName;", - "", - "", - "// Only change code above this line.", - "", - "(function(v){return v;})(secondToLastLetterOfLastName);" - ], - "type": "waypoint", - "challengeType": 1, - "nameEs": "Usa notación de corchetes para encontrar el n-ésimo último caracter de una cadena", - "descriptionEs": [ - "Puede utilizar el mismo principio utilizamos para recuperar el último caracter de una cadena para recuperar el n-ésimo último caracter.", - "Por ejemplo, se puede obtener el valor de la tercera última letra de la cadena var firstName = \"Charles\" utilizando firstName[firstName.length - 3] ", - "Usa notación de corchete para encontrar el segundo último caracter de la cadena en lastName.", - "Si te atascas intenta mirando la declaración de la variable thirdToLastLetterOfFirstName." - ] + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "cf1111c1c11feddfaeb3bdef", @@ -325,26 +258,21 @@ "description": [ "Let's try to add two numbers using JavaScript.", "JavaScript uses the + symbol for addition.", - "Change the 0 so that sum will equal 20." + "

Instructions

Change the 0 so that sum will equal 20." ], "tests": [ - "assert((function(){if(sum === 20 && editor.getValue().match(/\\+/g).length >= 2){return true;}else{return false;}})(), 'message: Make the variable sum equal 20.');" + "assert(sum === 20, 'message: sum should equal 20');", + "assert(/\\+/.test(editor.getValue()), 'message: Use the + operator');" ], "challengeSeed": [ "var sum = 10 + 0;", - "", - "// Only change code above this line.", - "", + "" + ], + "tail": [ "(function(z){return 'sum='+z;})(sum);" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Suma dos números con JavaScript", - "descriptionEs": [ - "Intentemos sumar dos números con JavaScript.", - "JavaScript utiliza el símbolo + para la adición.", - "Cambie el 0 para que la suma seá igual a 20." - ] + "challengeType": "1" }, { "id": "cf1111c1c11feddfaeb4bdef", @@ -352,26 +280,25 @@ "description": [ "We can also subtract one number from another.", "JavaScript uses the - symbol for subtraction.", - "Change the 0 so that difference will equal 12." + "

Instructions

Change the 0 so that difference will equal 12." ], "tests": [ - "assert((function(){if(difference === 12 && editor.getValue().match(/\\-/g)){return true;}else{return false;}})(), 'message: Make the variable difference equal 12.');" + "assert(difference === 12, 'message: Make the variable difference equal 12.');", + "assert(/\\d+\\s*-\\s*\\d+/.test(editor.getValue()),'message: User the - operator');" ], "challengeSeed": [ "var difference = 45 - 0;", "", - "// Only change code above this line.", - "", + "" + ], + "tail": [ "(function(z){return 'difference='+z;})(difference);" ], + "solutions": [ + "var difference = 45 - 33;" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Resta un número de otro con JavaScript", - "descriptionEs": [ - "También podemos restar un número de otro.", - "JavaScript utiliza el símbolo - de sustracción", - "Cambia el 0 para que la diferencia sea 12." - ] + "challengeType": "1" }, { "id": "cf1231c1c11feddfaeb5bdef", @@ -379,26 +306,25 @@ "description": [ "We can also multiply one number by another.", "JavaScript uses the * symbol for multiplication.", - "Change the 0 so that product will equal 80." + "

Instructions

Change the 0 so that product will equal 80." ], "tests": [ - "assert((function(){if(product === 80 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'message: Make the variable product equal 80.');" + "assert(product === 80,'message: Make the variable product equal 80');", + "assert(/\\*/.test(editor.getValue()), 'message: Use the * operator');" ], "challengeSeed": [ "var product = 8 * 0;", "", - "// Only change code above this line.", - "", - "(function(z){return 'product='+z;})(product);" + "" + ], + "tail": [ + "(function(z){return 'product = '+z;})(product);" + ], + "solutions": [ + "var product = 8 * 10;" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Multiplica dos números con JavaScript", - "descriptionEs": [ - "También podemos multiplicar un número por otro.", - "JavaScript utiliza el símbolo * de la multiplicación.", - "Cambie el 0 para que el producto sea igual a 80." - ] + "challengeType": "1" }, { "id": "cf1111c1c11feddfaeb6bdef", @@ -406,52 +332,125 @@ "description": [ "We can also divide one number by another.", "JavaScript uses the / symbol for division.", - "Change the 0 so that quotient will equal 2." + "

Instructions

Change the 0 so that quotient will equal 2." ], "tests": [ - "assert((function(){if(quotient === 2 && editor.getValue().match(/var\\s*?quotient\\s*?\\=\\s*?\\d+\\s*?\\/\\s*?\\d+\\s*?;/g)){return true;}else{return false;}})(), 'message: Make the variable quotient equal 2.');" + "assert(quotient === 2, 'message: Make the variable quotient equal 2.');", + "assert(/\\d+\\s*\\/\\s*\\d+/.test(editor.getValue()), 'message: Use the / operator');" ], "challengeSeed": [ "var quotient = 66 / 0;", "", - "// Only change code above this line.", - "", - "(function(z){return 'quotient='+z;})(quotient);" + "" + ], + "tail": [ + "(function(z){return 'quotient = '+z;})(quotient);" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Divide un número por otro con JavaScript", - "descriptionEs": [ - "También podemos dividir un número por otro.", - "JavaScript utiliza el símbolo / para dividir.", - "Cambia el 0 para que el cociente sea igual a 2." - ] + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244ac", + "title": "Increment a Number with Javascript", + "description": [ + "You can easily increment or add one to a Javascript variable with the ++ operator.", + "i++;", + "is the equivilent of", + "i = i + 1;", + "

Instructions

Change the code to use the ++ operator on myVar" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myVar === 88, 'message: myVar should equal 88');", + "assert(/[+]{2}/.test(editor.getValue()), 'message: Use the ++ operator');", + "assert(/var myVar = 87;/.test(editor.getValue()), 'message: Do not change code above the line');" + ], + "challengeSeed": [ + "var myVar = 87;", + "", + "// Only change code below this line", + "myVar = myVar + 1;", + "" + ], + "tail": [ + "(function(z){return 'myVar = ' + z;})(myVar);" + ], + "solutions": [ + "var myVar = 87;", + "myVar++;" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244ad", + "title": "Decrement a Number with Javascript", + "description": [ + "You can easily decrement or decrease by one a Javascript variable with the -- operator.", + "i--;", + "is the equivilent of", + "i = i - 1;", + "

Instructions

Change the code to use the -- operator on myVar" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myVar === 10, 'message: myVar should equal 10');", + "assert(/myVar[-]{2}/.test(editor.getValue()), 'message: Use the -- operator on myVar');", + "assert(/var myVar = 11;/.test(editor.getValue()), 'message: Do not change code above the line');" + ], + "challengeSeed": [ + "var myVar = 11;", + "", + "// Only change code below this line", + "myVar = myVar - 1;", + "" + ], + "tail": [ + "(function(z){return 'myVar = ' + z;})(myVar);" + ], + "solutions": [ + "var myVar = 87;", + "myVar--;" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "cf1391c1c11feddfaeb4bdef", "title": "Create Decimal Numbers with JavaScript", "description": [ - "JavaScript number variables can also have decimals.", + "JavaScript number variables can also have decimal points. Decimal numbers are sometimes refered to as floating point numbers or floats. ", + "Note", + "Not all real numbers can be accurately represented in floating point. This can lead to rounding errors. Details Here.", + "", "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;}})(), 'message: myDecimal should be a decimal point number.');" + "assert(typeof myDecimal === \"number\", 'message: myDecimal should be a number.');", + "assert(editor.getValue().match(/\\d+\\.\\d+/g).length >= 2, 'message: myDecimal should have a decimal point'); " ], "challengeSeed": [ "var ourDecimal = 5.7;", "", + "// Only change code below this line", "", - "// Only change code above this line.", - "", - "(function(){if(typeof myDecimal !== \"undefined\"){return myDecimal;}})();" + "" + ], + "tail": [ + "(function(){if(typeof(myDecimal) !== \"undefined\"){return myDecimal;}})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Crea números decimales con JavaScript", - "descriptionEs": [ - "Las variables tipo número en JavaScript también pueden tener decimales.", - "Vamos a crear una variable myDecimal y a darle un valor decimal." - ] + "challengeType": "1" }, { "id": "bd7993c9c69feddfaeb7bdef", @@ -462,24 +461,19 @@ "Change the 0.0 so that product will equal 5.0." ], "tests": [ - "assert((function(){if(product === 5.0 && editor.getValue().match(/\\*/g)){return true;}else{return false;}})(), 'message: Make the variable product equal 5.0.');" + "assert(product === 5.0, 'message: The variable product should equal 5.0.');", + "assert(/\\*/.test(editor.getValue()), 'message: You should use the * operator');" + ], + "tail": [ + "(function(y){return 'product = '+y;})(product);" ], "challengeSeed": [ "var product = 2.0 * 0.0;", "", - "", - "// Only change code above this line.", - "", - "(function(y){return 'product='+y;})(product);" + "" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Multiplica dos decimales con JavaScript", - "descriptionEs": [ - "En JavaScript, también puedes realizar cálculos con números decimales, al igual que con números enteros.", - "Vamos a multiplicar dos números decimales para obtener su producto.", - "Cambia el 0.0 para que el producto sea igual a 5.0." - ] + "challengeType": "1" }, { "id": "bd7993c9ca9feddfaeb7bdef", @@ -489,244 +483,1088 @@ "Change the 0.0 so that your quotient will equal 2.2." ], "tests": [ - "assert((function(){if(quotient === 2.2 && editor.getValue().match(/\\//g)){return true;}else{return false;}})(), 'message: Make the variable quotient equal 2.2.');" + "assert(quotient === 2.2, 'message: The variable quotient should equal 2.2.');", + "assert(/\\//.test(editor.getValue()), 'message: You should use the / operator');" ], "challengeSeed": [ "var quotient = 0.0 / 2.0;", "", - "", - "// Only change code above this line.", - "", - "(function(y){return 'quotient='+y;})(quotient);" + "" + ], + "tail": [ + "(function(y){return 'quotient = '+y;})(quotient);" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Divide un número decimal por otro con JavaScript", - "descriptionEs": [ - "Ahora vamos a dividir un decimal por otro.", - "Cambia el 0.0 para que tu cociente sea igual a 2.2." - ] + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244ae", + "title": "Find a Remainder with Modulus", + "description": [ + "The modulus operator % gives the remainder of the division of two numbers.", + "5 % 2 is 1 because", + "Math.floor(5 / 2) === 2
2 * 2 === 4
5 - 4 === 1
", + "Usage", + "Modulus can be helpful in creating alternating or cycling values. For example, in a loop an increasing variable myVar % 2 will alternate between 0 and 1 as myVar goes between even and odd numbers respectively.", + "

Instructions

Set remainder equal to the remainder of 11 divided by 3 using the modulus operator." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(remainder === 2, 'message: The value of remainder should be 2');", + "assert(/\\d+\\s*%\\s*\\d+/.test(editor.getValue()), 'message: You should use the % operator');" + ], + "challengeSeed": [ + "var quotient = Math.floor(11 / 3);", + "", + "// Only change code below this line", + "", + "var remainder;", + "", + "" + ], + "tail": [ + "(function(y){return 'remainder = '+y;})(remainder);" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244af", + "title": "Assignment with Plus Equals", + "description": [ + "In Javascript it is common to need to modify the contents of a variable mathematically. Remember that everything to the right of the equals sign is evaluated first, so we can say:", + "myVar = myVar + 5;", + "to add 5 to myVar. Since this is such a common pattern, there are operators which do both a mathematical operation and assignement in one step.", + "One such operator is the += operator.", + "myVar += 5; will add 5 to myVar.", + "

Instructions

Convert the assignements for a, b, and c to use the += operator." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(a === 15, 'message: a should equal 15');", + "assert(b === 26, 'message: b should equal 26');", + "assert(c === 19, 'message: c should equal 19');", + "assert(editor.getValue().match(/\\+=/g).length === 3, 'message: You should use the += operator for each variable');", + "assert(/var a = 3;/.test(editor.getValue()) && /var b = 17;/.test(editor.getValue()) && /var c = 12;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + ], + "challengeSeed": [ + "var a = 3;", + "var b = 17;", + "var c = 12;", + "", + "// Only modify code below this line", + "", + "a = a + 12;", + "b = 9 + b;", + "c = c + 7;", + "" + ], + "tail": [ + "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" + ], + "solutions": [ + "var a = 3;", + "var b = 17;", + "var c = 12;", + "", + "a += 12;", + "b += 9;", + "c += 7;" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b0", + "title": "Assignment with Minus Equals", + "description": [ + "Like the += operator, -= subtracts a number from a variable.", + "myVar = myVar - 5;", + "Will subtract 5 from myVar. This can be rewritten as: ", + "myVar -= 5;", + "

Instructions

Convert the assignements for a, b, and c to use the -= operator." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(a === 5, 'message: a should equal 5');", + "assert(b === -6, 'message: b should equal -6');", + "assert(c === 2, 'message: c should equal 2');", + "assert(editor.getValue().match(/-=/g).length === 3, 'message: You should use the -= operator for each variable');", + "assert(/var a = 11;/.test(editor.getValue()) && /var b = 9;/.test(editor.getValue()) && /var c = 3;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + ], + "challengeSeed": [ + "var a = 11;", + "var b = 9;", + "var c = 3;", + "", + "// Only modify code below this line", + "", + "a = a - 6;", + "b = b - 15;", + "c = c - 1;", + "", + "" + ], + "tail": [ + "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" + ], + "solutions": [ + "var a = 11;", + "var b = 9;", + "var c = 3;", + "", + "a -= 6;", + "b -= 15;", + "c -= 1;", + "", + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b1", + "title": "Assignment with Times Equals", + "description": [ + "Yhe *= operator multiplies a variable by a number.", + "myVar = myVar * 5;", + "Will multiply myVar by 5. This can be rewritten as: ", + "myVar *= 5;", + "

Instructions

Convert the assignements for a, b, and c to use the *= operator." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(a === 25, 'message: a should equal 25');", + "assert(b === 36, 'message: b should equal 36');", + "assert(c === 46, 'message: c should equal 46');", + "assert(editor.getValue().match(/\\*=/g).length === 3, 'message: You should use the *= operator for each variable');", + "assert(/var a = 5;/.test(editor.getValue()) && /var b = 12;/.test(editor.getValue()) && /var c = 4\\.6;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + ], + "challengeSeed": [ + "var a = 5;", + "var b = 12;", + "var c = 4.6;", + "", + "// Only modify code below this line", + "", + "a = a * 5;", + "b = 3 * b;", + "c = c * 10;", + "", + "" + ], + "tail": [ + "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" + ], + "solutions": [ + "var a = 20;", + "var b = 12;", + "var c = 96;", + "", + "a *= 5;", + "b *= 3;", + "c *= 10;" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b2", + "title": "Assignment with Divided by Equals", + "description": [ + "The /= operator divides a variable by another number.", + "myVar = myVar / 5;", + "Will divide myVar by 5. This can be rewritten as: ", + "myVar /= 5;", + "

Instructions

Convert the assignments for a, b, and c to use the /= operator." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(a === 4, 'message: a should equal 4');", + "assert(b === 27, 'message: b should equal 27');", + "assert(c === 3, 'message: c should equal 3');", + "assert(editor.getValue().match(/\\/=/g).length === 3, 'message: You should use the /= operator for each variable');", + "assert(/var a = 48;/.test(editor.getValue()) && /var b = 108;/.test(editor.getValue()) && /var c = 33;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + ], + "challengeSeed": [ + "var a = 48;", + "var b = 108;", + "var c = 33;", + "", + "// Only modify code below this line", + "", + "a = a / 12;", + "b = b / 4;", + "c = c / 11;", + "" + ], + "tail": [ + "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = \" + c; })(a,b,c);" + ], + "solutions": [ + "var a = 48;", + "var b = 108;", + "var c = 33;", + "", + "a /= 12;", + "b /= 4;", + "c /= 11;" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b3", + "title": "Convert Celsius to Fahrenheit", + "description": [ + "To test your learning you will create a solution \"from scratch\". Place your code between the indicated lines and it will be tested against multiple test cases.", + "The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.", + "You are given a variable Tc representing a temperature in Celsius. Create a variable Tf and apply the algorithm to assign it the corrasponding temperature in Fahrenheit." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof convert(0) === 'number', 'message: convert(0) should return a number');", + "assert(convert(-30) === -22, 'message: convert(-30) should return a value of -22');", + "assert(convert(-10) === 14, 'message: convert(-10) should return a value of 14');", + "assert(convert(0) === 32, 'message: convert(0) should return a value of 32');", + "assert(convert(20) === 68, 'message: convert(20) should return a value of 68');", + "assert(convert(30) === 86, 'message: convert(30) should return a value of 86');" + ], + "challengeSeed": [ + "function convert(Tc) {", + " // Only change code below this line", + "", + "", + " // Only change code above this line", + " if(typeof Tf !== 'undefined') {", + "\treturn Tf;", + " } else {", + " return \"Tf not defined\";", + " }", + "}", + "", + "// Change the inputs below to test your code", + "convert(30);" + ], + "solutions": [ + "function convert(Tc) {", + " var Tf = Tc * 9/5 + 32;", + " if(typeof Tf !== 'undefined') {", + "\treturn Tf;", + " } else {", + " return \"Tf not defined\";", + " }", + "}" + ], + "type": "bonfire", + "challengeType": "5", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "bd7123c9c444eddfaeb5bdef", + "title": "Declare String Variables", + "description": [ + "Previously we have used the code var myName = \"your name\". This is what we call a String variable. It is nothing more than a \"string\" of characters. JavaScript strings are always wrapped in quotes.", + "

Instructions

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;}})(), 'message: 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;}})(), 'message: myLastName should be a string with at least one character in it.');" + ], + "challengeSeed": [ + "// Example", + "var firstName = \"Alan\";", + "var lastName = \"Turing\";", + "", + "// Only change code below this line", + "", + "", + "" + ], + "tail": [ + "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return myFirstName + ', ' + myLastName;})();}" + ], + "solutions": [ + "var myFirstName = \"Alan\";", + "var myLastName = \"Turing\";" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244b5", + "title": "Escaping Literal Quotes in Strings", + "description": [ + "When you are defining a string you must start and end with a double or single quote. What happens when you need a literal quote inside of your string?", + "In Javascript you can escape a quote inside a string by placing a backslash (\\) in front of the quote. This signals Javascript that the following quote is not the end of the string, but should instead should appear inside the string.", + "

Instruction

Use backslashes to assign the following to myStr:
\"I am a \"double quoted\" string inside \"double quotes\"\"" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(editor.getValue().match(/\\\\\"/g).length === 4 && editor.getValue().match(/[^\\\\]\"/g).length === 2, 'message: You should use two double quotes (") and four escaped double quotes (\") ');" + ], + "challengeSeed": [ + "var myStr; // Change this line", + "", + "" + ], + "solutions": [ + "var myStr = \"I am a \\\"double quoted\\\" string inside \\\"double quotes\\\"\";" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b4", + "title": "Quoting Strings with Single Quotes", + "description": [ + "Strings in Javascript may be declared with both single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in Javascript.", + "\"This string has \\\"double quotes\\\" in it\"", + "The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to write and to read. Instead, use single quotes:", + "'This string has \"double quotes\" in it'", + "

Instructions

Change the provided string from double to single quotes and remove the escaping." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(!/\\\\/g.test(editor.getValue()), 'message: Remove all the backslashes (\\)');", + "assert(editor.getValue().match(/\"/g).length === 4 && editor.getValue().match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "')" + ], + "challengeSeed": [ + "var myStr = \"Link\";", + "", + "" + ], + "solutions": [ + "var myStr = 'Link';" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b6", + "title": "Escape Sequences in Strings", + "description": [ + "Quotes are not the only character than can be escaped inside a string. Here is a table of common escape sequences:", + "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", + "Note that the backslash itself must be escaped in order to display as a backslash.", + "

Instructions

Encode the following sequence, seperated by spaces:
backslash tab tab carriage return new line and assign it to myStr" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myStr === \"\\\\ \\t \\t \\r \\n\", 'message: myStr should have the escape sequences for backslash tab tab carriage return new line seperated by spaces');" + ], + "challengeSeed": [ + "var myStr; // Change this line", + "", + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b7", + "title": "Concatanting Strings with the Plus Operator", + "description": [ + "In Javascript the + operator for strings is called the concatanation operator. You can build strings out of other strings by concatanating them together.", + "

Instructions

Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator.", + "" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end');", + "assert(editor.getValue().match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" + ], + "challengeSeed": [ + "// Example", + "var ourStr = \"I come first. \" + \"I come second.\";", + "", + "// Only change code below this line", + "", + "var myStr;", + "", + "" + ], + "solutions": [ + "var myStr = \"This is the start. \" + \"This is the end.\";" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b8", + "title": "Concatanting Strings with the Plus Equals Operator", + "description": [ + "We can also use the += operator to concatanae a string onto the end of an existing string. This can be very helpful to break a long string over several lines.", + "

Instructions

", + "Build myStr over several lines by concatanating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myStr === \"This is the first line. This is the second line.\", 'message: myStr should have a value of This is the first line. This is the second line.');", + "assert(editor.getValue().match(/\\w\\s*\\+=\\s*\"/g).length > 1 && editor.getValue().match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" + ], + "challengeSeed": [ + "// Example", + "var ourStr = \"I come first. \";", + "ourStr += \"I come second.\";", + "", + "// Only change code below this line", + "", + "var myStr;", + "", + "" + ], + "solutions": [ + "var myStr = \"This is the first line. \";", + "myStr += \"This is the second line.\";" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244b9", + "title": "Constructing Strings with Variables", + "description": [ + "Sometimes you will need to build a string, Mad Libs style. By using the concatanation operator (+) you can insert one or more varaibles into a string you're building.", + "

Instructions

Set myName and build myStr with myName between the strings \"My name is \" and \" and I am swell!\"" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof myName !== 'undefined' && myName.length > 2, 'message: myName should be set to a string at least 3 characters long');", + "assert(editor.getValue().match(/\"\\s*\\+\\s*myName\\s*\\+\\s*\"/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" + ], + "challengeSeed": [ + "// Example", + "var ourName = \"Free Code Camp\";", + "var ourStr = \"Hello, our name is \" + ourName + \", how are you?\";", + "", + "// Only change code below this line", + "var myName;", + "var myStr;", + "", + "" + ], + "solutions": [ + "var myName = \"Bob\";", + "var myStr = \"My name is \" + myName + \" and I am swell!\";" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244ed", + "title": "Appending Variables to Strings", + "description": [ + "Just as we can build a string over multiple lines out of string literals, we can also append variables to a string using the plus equals (+=) operator.", + "

Instructions

Set someAdjective and append it to myStr using the += operator." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, 'message: someAdjective should be set to a string at least 3 characters long');", + "assert(editor.getValue().match(/\\w\\s*\\+=\\s*someAdjective\\s*;/).length > 0, 'message: Append someAdjective to myStr using the += operator');" + ], + "challengeSeed": [ + "// Example", + "var anAdjective = \"awesome!\";", + "var ourStr = \"Free Code Camp is \";", + "ourStr += anAdjective;", + "", + "// Only change code below this line", + "", + "var someAdjective;", + "var myStr = \"Learning to code is \";", + "" + ], + "solutions": [ + "var anAdjective = \"awesome!\";", + "var ourStr = \"Free Code Camp is \";", + "ourStr += anAdjective;", + "", + "var someAdjective = \"neat\";", + "var myStr = \"Learning to code is \";", + "myStr += someAdjective;" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "bd7123c9c448eddfaeb5bdef", + "title": "Check the Length Property of a String Variable", + "description": [ + "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.", + "

Instructions

Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength." + ], + "tests": [ + "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'message: 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;}})(), 'message: You should be getting the length of lastName by using .length like this: lastName.length.');" + ], + "challengeSeed": [ + "// Example", + "var firstNameLength = 0;", + "var firstName = \"Ada\";", + "", + "firstNameLength = firstName.length;", + "", + "// Setup", + "var lastNameLength = 0;", + "var lastName = \"Lovelace\";", + "", + "// Only change code below this line.", + "", + "lastNameLength = lastName;", + "", + "" + ], + "tail": [ + "if(typeof(lastNameLength) !== \"undefined\"){(function(){return lastNameLength;})();}" + ], + "solution": "var lastNameLength = 0;\nvar lastName = \"Lovelace\";\nlastNameLength = lastName.length;", + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "bd7123c9c549eddfaeb5bdef", + "title": "Use Bracket Notation to Find the First Character in a String", + "description": [ + "Bracket notation is a way to get a character at a specific index within a string.", + "Computers don't start counting at 1 like humans do. They start at 0. This is refered to as Zero-based indexing.", + "For example, the character at index 0 in the word \"Charles\" is \"C\". So if var firstName = \"Charles\", you can get the value of the first letter of the string by using firstName[0].", + "

Instructions

Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", + "Hint
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;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" + ], + "challengeSeed": [ + "// Example", + "var firstLetterOfFirstName = \"\";", + "var firstName = \"Ada\";", + "", + "firstLetterOfFirstName = firstName[0];", + "", + "// Setup", + "var firstLetterOfLastName = \"\";", + "var lastName = \"Lovelace\";", + "", + "// Only change code below this line", + "firstLetterOfLastName = lastName;", + "" + ], + "tail": [ + "(function(v){return v;})(firstLetterOfLastName);" + ], + "solutions": [ + "var firstLetterOfLastName = \"\";", + "var lastName = \"Lovelace\";", + "", + "// Only change code below this line", + "firstLetterOfLastName = lastName.length" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244ba", + "title": "Understand String Immutability", + "description": [ + "In Javascript, strings are immutable, which means that they cannot be changed or modified once created. For example, this code:", + "var myStr = \"Bob\";
myStr[0] = \"J\";
", + "will not change the contents of myStr to \"Job\", because the contents of myStr cannot be altered. Note that this does not mean that myStr cannot be change, just that individual characters cannot be changes. The only way to change myStr would be to overwrite the contents with a new string, like this:", + "var myStr = \"Bob\";
myStr = \"Job\";
", + "

Instructions

Correct the assignment to myStr to achieve the desired effect." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myStr === \"Hello World\", 'message: myStr should have a value of Hello World');", + "assert(/myStr = \"Jello World\"/.test(editor.getValue()), 'message: Do not change the code above the line');" + ], + "tail": [ + "(function(v){return \"myStr = \" + v;})(myStr);" + ], + "challengeSeed": [ + "// Setup", + "var myStr = \"Jello World\";", + "", + "// Only change code below this line", + "", + "myStr[0] = \"H\"; // Fix Me", + "", + "" + ], + "solutions": [ + "var myStr = \"Jello World\";", + "myStr = \"Hello World\";" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "bd7123c9c450eddfaeb5bdef", + "title": "Use Bracket Notation to Find the Nth Character in a String", + "description": [ + "You can also use bracket notation to get the character at other positions within a string.", + "Remember that computers start counting at 0, so the first character is actually the zeroth character.", + "

Instructions

Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", + "Hint
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." + ], + "tests": [ + "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');" + ], + "challengeSeed": [ + "// Example", + "var firstName = \"Ada\";", + "var secondLetterOfFirstName = firstName[1];", + "", + "// Setup", + "var lastName = \"Lovelace\";", + "", + "// Only change code below this line.", + "var thirdLetterOfLastName = lastName;", + "", + "" + ], + "tail": [ + "(function(v){return v;})(thirdLetterOfLastName);" + ], + "solutions": [ + "var lastName = \"Lovelace\";", + "var thirdLetterOfLastName = lastName[2];" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "bd7123c9c451eddfaeb5bdef", + "title": "Use Bracket Notation to Find the Last Character in a String", + "description": [ + "In order to get the last letter of a string, you can subtract one from the string's length.", + "For example, if var firstName = \"Charles\", you can get the value of the last letter of the string by using firstName[firstName.length - 1].", + "

Instructions

Use bracket notation to find the last character in the lastName variable.", + "Hint
Try looking at the lastLetterOfFirstName variable declaration if you get stuck." + ], + "tests": [ + "assert(lastLetterOfLastName === \"e\", 'message: lastLetterOfLastName should be \"e\".');", + "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use .length to get the last letter.');" + ], + "challengeSeed": [ + "// Example", + "var firstName = \"Ada\";", + "var lastLetterOfFirstName = firstName[firstName.length - 1];", + "", + "// Setup", + "var lastName = \"Lovelace\";", + "", + "// Only change code below this line.", + "var lastLetterOfLastName = lastName;", + "", + "" + ], + "tail": [ + "(function(v){return v;})(lastLetterOfLastName);" + ], + "solutions": [ + "var lastName = \"Lovelace\";", + "var lastLetterOfLastName = lastName[lastName.length - 1];" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "bd7123c9c452eddfaeb5bdef", + "title": "Use Bracket Notation to Find the Nth-to-Last Character in a String", + "description": [ + "You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.", + "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]", + "

Instructions

Use bracket notation to find the second-to-last character in the lastName string.", + " Hint
Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." + ], + "tests": [ + "assert(secondToLastLetterOfLastName === 'c', 'message: secondToLastLetterOfLastName should be \"c\".');", + "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use .length to get the second last letter.');" + ], + "challengeSeed": [ + "// Example", + "var firstName = \"Ada\";", + "var thirdToLastLetterOfFirstName = firstName[firstName.length - 3];", + "", + "// Setup", + "var lastName = \"Lovelace\";", + "", + "// Only change code below this line", + "var secondToLastLetterOfLastName = lastName;", + "", + "" + ], + "tail": [ + "(function(v){return v;})(secondToLastLetterOfLastName);" + ], + "solutions": [ + "var lastName = \"Lovelace\";", + "var secondToLastLetterOfLastName = lastName[lastName.length - 2];" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244bb", + "title": "Word Blanks", + "description": [ + "We will now use our knowledge of strings to build a \"Mad Libs\" style word game we're calling \"Word Blanks\". We have provided a framework for testing your results with different words. ", + "You will need to use string operators to build a new string, result, using the provided variables: ", + "myNoun, myAdjative, myVerb, and myAdverb.", + "The tests will run your function with several different inputs to make sure it works properly." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string');", + "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 50, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 50 characters with empty inputs');", + "assert(/dog/.test(test1) && /big/.test(test1) && /ran/.test(test1) && /quickly/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words.');", + "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" + ], + "challengeSeed": [ + "function wordBlanks(myNoun, myAdjative, myVerb, myAdverb) {", + " var result = \"\";", + " // Your code below this line", + "", + "", + " // Your code above this line", + "\treturn result;", + "}", + "", + "// Change the words here to test your function", + "wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\");" + ], + "tail": [ + "var test1 = wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\");", + "var test2 = wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\");" + ], + "solutions": [ + "function wordBlanks(myNoun, myAdjative, myVerb, myAdverb) {", + " var result = \"\";", + " result = \"Once there was a \" + myNoun + \" which was very \" + myAdjative + \". \";", + "\tresult += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";", + "\treturn result;", + "}" + ], + "type": "bonfire", + "challengeType": "5", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "bd7993c9c69feddfaeb8bdef", "title": "Store Multiple Values in one Variable using JavaScript Arrays", "description": [ "With JavaScript array variables, we can store several pieces of data in one place.", - "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." + "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\"].", + "

Instructions

Create a new array called myArray that contains both a string and a number (in that order).", + "Hint
Refer to the example code in the text editor if you get stuck." ], "tests": [ - "assert(typeof myArray == 'object', 'message: myArray should be an array.');", - "assert(typeof myArray[0] !== 'undefined' && typeof myArray[0] == 'string', 'message: The first item in myArray should be a string.');", - "assert(typeof myArray[1] !== 'undefined' && typeof myArray[1] == 'number', 'message: The second item in myArray should be a number.');" + "assert(typeof(myArray) == 'object', 'message: myArray should be an array.');", + "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'message: The first item in myArray should be a string.');", + "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'message: The second item in myArray should be a number.');" ], "challengeSeed": [ + "// Example", "var array = [\"John\", 23];", "", "// Only change code below this line.", - "", "var myArray = [];", - "", - "// Only change code above this line.", - "", + "" + ], + "tail": [ "(function(z){return z;})(myArray);" ], + "solutions": [ + "var myArray = [\"The Answer\", 42];" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Almacena múltiples valores en una variable utilizando vectores en JavaScript", - "descriptionEs": [ - "Con las variables tipo vector (o en inglés array) podemos almacenar diversos datos en un solo lugar.", - "Empiezas la declaración de un vector con un corchete de apertura, y terminas con un corchete de cierre, y pones una coma entre cada entrada, así: var sandwich = [\"mantequilla de maní\", \"jalea\" , \"pan\"]. ", - "Ahora vamos a crear un nuevo vector llamado myArray que contenga una cadena y un número (en ese orden).", - "Consulta el código comentado en el editor de texto si te atascas." - ] + "challengeType": "1" }, { "id": "cf1111c1c11feddfaeb7bdef", "title": "Nest one Array within Another Array", "description": [ - "You can also nest arrays within other arrays, like this: [[\"Bulls\", 23]].", - "Let's now go create a nested array called myArray." + "You can also nest arrays within other arrays, like this: [[\"Bulls\", 23]]. This is also called a Multi-dimensional Array.", + "

Instructions

Create a nested array called myArray." ], "tests": [ "assert(Array.isArray(myArray) && myArray.some(Array.isArray), 'message: myArray should have at least one array nested within another array.');" ], "challengeSeed": [ + "// Example", "var ourArray = [[\"the universe\", \"everything\", 42]];", "", "// Only change code below this line.", - "", "var myArray = [];", - "", - "// Only change code above this line.", - "", - "if(typeof myArray !== \"undefined\"){(function(){return myArray;})();}" + "" + ], + "tail": [ + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" + ], + "solutions": [ + "var myArray = [[1,2,3]];" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Anida un vector dentro de otro vector", - "descriptionEs": [ - "También puedes anidar vectores dentro de otros vectores, como este: [[\"Bulls\", 23]].", - "Ahora vamos a crear un vector anidado llamado myArray." - ] + "challengeType": "1" }, { "id": "bg9997c9c79feddfaeb9bdef", "title": "Access Array Data with Indexes", "description": [ "We can access the data inside arrays using indexes.", - "Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array.", + "Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array is element 0", "For example:", "var array = [1,2,3];", "array[0]; //equals 1", "var data = array[1];", - "Create a variable called myData and set it to equal the first value of myArray." + "

Instructions

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;}})(), 'message: 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;}})(), 'message: The variable myData should equal the first value of myArray.');" ], "challengeSeed": [ + "// Example", "var ourArray = [1,2,3];", - "", "var ourData = ourArray[0]; // equals 1", "", + "// Setup", "var myArray = [1,2,3];", "", "// Only change code below this line.", - "", - "", - "// Only change code above this line.", - "", - "if(typeof myArray !== \"undefined\" && typeof myData !== \"undefined\"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}" + "" + ], + "tail": [ + "if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}" + ], + "solutions": [ + "var myArray = [1,2,3];", + "var myData = myArray[0];" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Accede a los datos de un vector mediante índices", - "descriptionEs": [ - "Podemos acceder a los datos dentro de los vectores usando índices.", - "Los índices del vector se escriben en la misma notación con corchetes usado con cadenas, excepto que en lugar de especificar un caracter, especifican un elemento del vector.", - "Por ejemplo:", - "var array = [1,2,3];", - "array[0]; //es igual a 1", - "var data = array[1];", - "Crea una variable llamada myData y asignale el primer valor del vector myArray." - ] + "challengeType": "1" }, { "id": "cf1111c1c11feddfaeb8bdef", "title": "Modify Array Data With Indexes", "description": [ - "We can also modify the data stored in arrays by using indexes.", + "Unlike strings, the contents of arrays can are mutable and can be freely changed.", "For example:", "var ourArray = [3,2,1];", "ourArray[0] = 1; // equals [1,2,1]", - "Now modify the data stored at index 0 of myArray to the value of 3." + "

Instructions

Modify the data stored at index 0 of myArray to a value of 3." ], "tests": [ - "assert((function(){if(typeof myArray != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: myArray should now be [3,2,3].');", + "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: myArray should now be [3,2,3].');", "assert((function(){if(editor.getValue().match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'message: You should be using correct index to modify the value in myArray.');" ], "challengeSeed": [ + "// Example", "var ourArray = [1,2,3];", - "", "ourArray[1] = 3; // ourArray now equals [1,3,3].", "", + "// Setup", "var myArray = [1,2,3];", "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", - "if(typeof myArray !== \"undefined\"){(function(){return myArray;})();}" + "" + ], + "tail": [ + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" + ], + "solutions": [ + "var myArray = [1,2,3];", + "myArray[0] = 3;" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Modifica datos de un vector usando índices", - "descriptionEs": [ - "También podemos modificar los datos almacenados en vectores usando índices.", - "Por ejemplo:", - "var ourArray = [3,2,1];", - "ourArray[0] = 1; // equals [1,2,1]", - "Ahora establece el dato almacenado en el índice 0 de myArray para que sea el valor 3." - ] + "challengeType": "1" }, { - "id": "bg9994c9c69feddfaeb9bdef", - "title": "Manipulate Arrays With pop()", + "id": "56592a60ddddeae28f7aa8e1", + "title": "Access Multi-Dimensional Arrays With Indexes", "description": [ - "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 store this \"popped off\" variable by performing pop() within a variable declaration.", - "Any type of data structure can be \"popped\" off of an array - numbers, strings, even nested arrays.", - "Use the .pop() function to remove the last item from myArray, assigning the \"popped off\" value to removedFromMyArray." + "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the outer-most array, and each subsequent level of brackets refers to the next level in.", + "For example:", + "
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
", + "arr[0]; // equals [1,2,3]", + "arr[1][2]; // equals 6", + "arr[3][0][1]; // equals 11", + "

Instructions

Read from myArray using bracket notation so that myData is equal to 8" ], "tests": [ - "assert((function(d){if(d[0] == 'John' && d[1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should only contain [\"John\", 23].');", - "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should only contain [\"cat\", 2].');" + "assert(myData === 8, 'message: myData should be equal to 8.');", + "assert(/myArray\\[2\\]\\[1\\]/g.test(editor.getValue()), 'message: You should be using bracket notation to read the value from myArray.');" ], "challengeSeed": [ - "var ourArray = [1,2,3];", - "", - "var removedFromOurArray = ourArray.pop(); // removedFromOurArray now equals 3, and ourArray now equals [1,2]", - "", - "var myArray = [\"John\", 23, [\"cat\", 2]];", + "// Setup", + "var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];", "", "// Only change code below this line.", - "", - "var removedFromMyArray;", - "", - "// Only change code above this line.", - "", - "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);" + "var myData = myArray[0][0];", + "" + ], + "tail": [ + "if(typeof(myArray) !== \"undefined\"){(function(){return \"myData: \" + myData + \" myArray: \" + JSON.stringify(myArray);})();}" + ], + "solutions": [ + "var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];", + "var myData = myArray[2][1];" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Manipula vectores con pop()", - "descriptionEs": [ - "Otra forma de cambiar los datos en un vector es con la función .pop().", - ".pop() se utiliza para \"sacar\" el valor final de un vector. Podemos almacenar el valor \"sacado\" asignando pop a una variable por ejemplo durante su declaración.", - "Todo tipo de datos puede ser \"sacado\" de un vector --números, cadenas, incluso los vectores anidadas.", - "Usa la función .pop() para sacar el último elemento de myArray y asigna ese valor \"sacado\" a removedFromMyArray ." - ] + "challengeType": "1" }, { "id": "bg9995c9c69feddfaeb9bdef", "title": "Manipulate Arrays With push()", "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.", - "Push [\"dog\", 3] onto the end of the myArray variable." + "An easy way to append data to the end of an array is via the push() method. push() takes a value and \"pushes\" it onto the end of the array.", + "var arr = [1,2,3];", + "arr.push(4);", + "// arr is now [1,2,3,4]", + "

Instructions

Push [\"dog\", 3] onto the end of the myArray variable." ], "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), 'message: myArray should now equal [\"John\", 23, [\"dog\", 3]].');" + "\nassert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" ], "challengeSeed": [ - "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", + "// Example", + "var ourArray = [\"Stimpson\", \"J\", \"cat\"];", + "ourArray.push([\"happy\", \"joy\"]); ", + "// ourArray now equals [\"Stimpson\", \"J\", \"cat\", [\"happy\", \"joy\"]]", "", - "ourArray.pop(); // ourArray now equals [\"Stimpson\", \"J\"]", - "", - "ourArray.push([\"happy\", \"joy\"]); // ourArray now equals [\"Stimpson\", \"J\", [\"happy\", \"joy\"]]", - "", - "var myArray = [\"John\", 23, [\"cat\", 2]];", - "", - "myArray.pop();", + "// Setup", + "var myArray = [[\"John\", 23], [\"cat\", 2]];", "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", + "\t" + ], + "tail": [ "(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);" ], + "solutions": [ + "var myArray = [[\"John\", 23], [\"cat\", 2]];", + "myArray.push([\"dog\",3]);" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Manipula vectores con push()", - "descriptionEs": [ - "No sólo se pueden sacar datos del final de un vector con pop(), también puedes empujar (push()) datos al final del vector.", - "Empuja [\"dog\", 3] al final de la variable myArray." - ] + "challengeType": "1" + }, + { + "id": "bg9994c9c69feddfaeb9bdef", + "title": "Manipulate Arrays With pop()", + "description": [ + "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 store this \"popped off\" variable by performing pop() within a variable declaration.", + "Any type of data structure can be \"popped\" off of an array - numbers, strings, even nested arrays.", + "

Instructions

Use the .pop() function to remove the last item from myArray, assigning the \"popped off\" value to removedFromMyArray." + ], + "tests": [ + "assert((function(d){if(d[0][0] == 'John' && d[0][1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should only contain [[\"John\", 23]].');", + "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should only contain [\"cat\", 2].');" + ], + "challengeSeed": [ + "// Example", + "var ourArray = [1,2,3];", + "var removedFromOurArray = ourArray.pop(); ", + "// removedFromOurArray now equals 3, and ourArray now equals [1,2]", + "", + "// Setup", + "var myArray = [[\"John\", 23], [\"cat\", 2]];", + "", + "// Only change code below this line.", + "var removedFromMyArray;", + "", + "" + ], + "tail": [ + "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1" }, { "id": "bg9996c9c69feddfaeb9bdef", @@ -734,34 +1572,37 @@ "description": [ "pop() always removes the last element of an array. What if you want to remove the first?", "That's where .shift() comes in. It works just like .pop(), except it removes the first element instead of the last.", - "Use the .shift() function to remove the first item from myArray, assigning the \"shifted off\" value to removedFromMyArray." + "

Instructions

Use the .shift() function to remove the first item from myArray, assigning the \"shifted off\" value to removedFromMyArray." ], "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), 'message: myArray should now equal [23, [\"dog\", 3]].');", - "assert((function(d){if(d === 'John' && typeof removedFromMyArray === 'string'){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should contain \"John\".');" + "assert((function(d){if(d[0][0] == 'dog' && d[0][1] == 3 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"dog\", 3]].');", + "assert((function(d){if(d[0] === 'John' && d[1] === 23 && typeof(removedFromMyArray) === 'object'){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should contain [\"John\", 23].');" ], "challengeSeed": [ + "// Example", "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", + "removedFromOurArray = ourArray.shift();", + "// removedFromOurArray now equals \"Stimpson\" and ourArray now equals [\"J\", [\"cat\"]].", "", - "var removedFromOurArray = ourArray.shift(); // removedFromOurArray now equals \"Stimpson\" and ourArray now equals [\"J\", [\"cat\"]].", + "// Setup", + "var myArray = [[\"John\", 23], [\"dog\", 3]];", "", + "// Only change code below this line.", + "var removedFromMyArray;", + "", + "" + ], + "tail": [ + "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);" + ], + "solutions": [ "var myArray = [\"John\", 23, [\"dog\", 3]];", "", "// Only change code below this line.", - "", - "var removedFromMyArray;" - ], - "tail":[ - "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);" + "var removedFromMyArray = myArray.shift();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Manipula vectores con shift()", - "descriptionEs": [ - "pop() siempre elimina el último elemento de un vector. ¿Qué pasa si quieres quitar el primero?", - "Ahí es donde entra .shift(). Funciona igual que .pop (), excepto que elimina el primer elemento en lugar del pasado. ", - "Usa la función .shift() para eliminar el primer elemento de myArray, y el elemento que saques asignalo a removedFromMyArra" - ] + "challengeType": "1" }, { "id": "bg9997c9c69feddfaeb9bdef", @@ -769,90 +1610,1603 @@ "description": [ "Not only can you shift elements off of the beginning of an array, you can also unshift elements onto the beginning of an array.", "unshift() works exactly like push(), but instead of adding the element at the end of the array, unshift() adds the element at the beginning of the array.", - "Add \"Paul\" onto the beginning of the myArray variable using unshift()." + "

Instructions

Add [\"Paul\",35] onto the beginning of the myArray variable using unshift()." ], "tests": [ - "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), 'message: myArray should now have [\"Paul\", 23, [\"dog\", 3]]).');" + "assert((function(d){if(typeof(d[0]) === \"object\" && d[0][0].toLowerCase() == 'paul' && d[0][1] == 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), 'message: myArray should now have [[\"Paul\", 35], [\"dog\", 3]]).');" ], "challengeSeed": [ - "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", - "", - "ourArray.shift(); // ourArray now equals [\"J\", [\"cat\"]]", - "", - "ourArray.unshift(\"happy\"); // ourArray now equals [\"happy\", \"J\", [\"cat\"]]", - "", - "var myArray = [\"John\", 23, [\"dog\", 3]];", + "// Example", + "var ourArray = [\"Stimpson\", \"J\", \"cat\"];", + "ourArray.shift(); // ourArray now equals [\"J\", \"cat\"]", + "ourArray.unshift(\"Happy\"); ", + "// ourArray now equals [\"Happy\", \"J\", \"cat\"]", "", + "// Setup", + "var myArray = [[\"John\", 23], [\"dog\", 3]];", "myArray.shift();", "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", + "" + ], + "tail": [ "(function(y, z){return 'myArray = ' + JSON.stringify(y);})(myArray);" ], + "solutions": [ + "var myArray = [[\"John\", 23], [\"dog\", 3]];", + "myArray.shift();", + "myArray.unshift([\"Paul\", 35]);" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Manipula vectores con unshift()", - "descriptionEs": [ - "No sólo se puedes correr (shift) elementos del comienzo de un vector, también puedes descorrerlos (unshift) al comienzo.", - "unshift() funciona exactamente igual que push(), pero en lugar de añadir el elemento al final del vector, unshift() añade el elemento al comienzo del vector. ", - "Añade \"Paul\" al comienzo de la variable myArray usando unshift()." - ] + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244bc", + "title": "Shopping List", + "description": [ + "Create a shopping list in the variable myList. The list should be a multi-dimensional array containing several sub-arrays. ", + "The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity. IE:", + "[\"Chocolate Bar\", 15]", + "There should be at least 5 sub-arrays in the list." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(isArray, 'message: myList should be an array');", + "assert(hasString, 'message: The first elements in each of your sub-arrays must all be strings');", + "assert(hasNumber, 'message: The second elements in each of your sub-arrays must all be numbers');", + "assert(count > 4, 'message: You must have at least 5 items in your list');" + ], + "challengeSeed": [ + "var myList = [];", + "", + "" + ], + "tail": [ + "var count = 0;", + "var isArray = true;", + "var hasString = true;", + "var hasNumber = true;", + "(function(list){", + " if(Array.isArray(myList)) {", + " myList.forEach(function(elem) {", + " if(typeof elem[0] !== 'string') {", + " hasString = false;", + " }", + " if(typeof elem[1] !== 'number') {", + " hasNumber = false;", + " }", + " });", + " count = myList.length;", + " return JSON.stringify(myList);", + " } else {", + " isArray = false;", + " return \"myList is not an array\";", + " }", + "", + "})(myList);" + ], + "solutions": [ + "var myList = [", + " [\"Candy\", 10],", + " [\"Potatoes\", 12],", + " [\"Eggs\", 12],", + " [\"Catfood\", 1],", + " [\"Toads\", 9]", + "];" + ], + "type": "bonfire", + "challengeType": "5", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "bg9997c9c89feddfaeb9bdef", "title": "Write Reusable JavaScript with Functions", "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() {", + "  console.log(\"Hello World\");", "}", - "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." + "You can call or invoke this function by using its name followed by parenthese, like this:", + "functionName();", + "Each time the function is called it will print out the message \"Hello World\" on the dev console. All of the code between the curly braces will be executed every time the function is called.", + "

Instructions

Create a function called myFunction which prints \"Hi World\" to the dev console. Call that function." ], "tests": [ - "assert((function(){if(typeof f !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'message: Your function should return the value of a + b.');" + "console.log(\"1 '\" + logOutput + \"'\", \"op: \" + /Hi World/.test(logOutput)); assert(\"Hi World\" === logOutput, 'message: myFunction should output \"Hi World\"');", + "assert(typeof myFunction === 'function', 'message: myFunction should be a function');" ], "challengeSeed": [ - "var a = 4;", - "var b = 5;", - "", - "function ourFunction(a, b) {", - " return a - b;", + "// Example", + "function ourFunction() {", + " console.log(\"Heyya, World\");", "}", "", + "// Only change code below this line", + "", + "" + ], + "tail": [ + "var logOutput = \"\";", + "var oldLog = console.log;", + "function capture() {", + " console.log = function (message) {", + " logOutput = message.trim();", + " oldLog.apply(console, arguments);", + " };", + "}", + "", + "function uncapture() {", + " console.log = oldLog;", + "}", + "", + "if (typeof myFunction !== \"function\") { ", + " (function() { return \"myFunction is not defined\"; })();", + "} else {", + " capture();", + " myFunction(); ", + " uncapture();", + " (function() { return logOutput || \"console.log never called\"; })();", + "}" + ], + "solutions": [ + "function myFunction() {", + " console.log(\"Hi World\");", + "}" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244bd", + "title": "Passing Values to Functions with Arguments", + "description": [ + "Functions can take input in the form of parameters. Parameters are variables that take on the value of the arguments which are passed in to the function. Here is a function with two parameters, param1 and param2:", + "function testFunct(param1, param2) {", + "  console.log(param1, param2);", + "}", + "Then we can call testFunction:", + "testFunction(\"Hello\", \"World\");", + "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFunction again with different arguments and the parameters would take on the value of the new arguments.", + "

Instructions

Create a function called myFunction that accepts two arguements and outputs their sum to console.log" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'message: Your function should ouput the value of a + b.');" + ], + "challengeSeed": [ + "// Example", + "function ourFunction(a, b) {", + " console.log(a - b);", + "}", + "ourFunction(10, 5); // Outputs 5", + "", "// Only change code below this line.", "", "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244be", + "title": "Global Scope and Functions", + "description": [ + "In Javascript, scope refers to the visibility of variables." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ "", "", - "// Only change code above this line.", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244bf", + "title": "Local Scope and Functions", + "description": [ + "In Javascript, Scope is the test of variables, object, and functions you have access to. Variables which are defined within a function and parameters are local, which means they are only visible within that function. ", + "Here is a function test with a local variable called loc.", + "
function test() {
var loc = \"foo\";
console.log(local1); // \"foo\"
}
test();
console.log(loc); // \"undefined\"
", + "loc is not defined outside of the function." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ "", - "if(typeof myFunction !== \"undefined\"){", - "var f=myFunction(a,b);", - "(function(){return f;})();", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c0", + "title": "Global vs. Local Scope in Functions", + "description": [ + "Show how global and local scopes interact" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c1", + "title": "Context for Functions", + "description": [ + "Show how each instance of a function has its own values/context" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c2", + "title": "Return a Value from a Function with Return", + "description": [ + "We can pass values into a function with arguments. You can use a return statement to send a value back out of a function.", + "For Example:", + "
function plusThree(num) {
return num + 3;
}
var answer = plusThree(5); // 8
", + "plusThree takes an argument for num and returns a value equal to num + 3.", + "

Instructions

Create a function timesFive that accepts one argument, multiplies it by 5, and returns the new value." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof timesFive === 'function', 'message: timesFive should be a function');", + "assert(timesFive(5) === 25, 'message: timesFive(5) should return 25');", + "assert(timesFive(2) === 10, 'message: timesFive(2) should return 10');", + "assert(timesFive(0) === 0, 'message: timesFive(0) should return 0');" + ], + "challengeSeed": [ + "// Example", + "function minusSeven(num) {", + " return num - 7;", + "}", + "", + "// Only change code below this line", + "", + "" + ], + "tail": [ + "(function() { if(typeof timesFive === 'function'){ return \"timesfive(5) === \" + timesFive(5); } else { return \"timesFive is not a function\"} })();" + ], + "solutions": [ + "function timesFive(num) {", + " return num * 5;", "}" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Escribe código Javascript reutilizable con funciones", - "descriptionEs": [ - "En JavaScript, podemos dividir nuestro código en partes reutilizables llamadas funciones.", - "He aquí un ejemplo de una función:", - "function nombreDeFuncion(a, b) {", - "& nbsp; & nbsp; return a + b;", - "}", - "Después de escribir las líneas anteriores en nuestro código, podemos pasar valores a nuestra función y el resultado que sigue a la instrucción return será retornado.", - "Por ejemplo, podemos pasar los números 4 y 2 al \"llamar\" la función más adelante en nuestro código, así: nombreDeFuncion(4, 2). ", - "En este ejemplo, la función devolverá el número 6, ya que es el resultado de 4 + 2.", - "Crea y llama una función de nombre myFunction que devuelva la suma de a y b." - ] + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c3", + "title": "Assignment with a Returned Value", + "description": [ + "If you'll recall from our discussion of Storing Values with the Equal Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.", + "Assume we have pre-defined a function sum which adds two numbers together, then: ", + "var ourSum = sum(5, 12);", + "will call sum, which returns a value of 17 and assigns it to ourSum.", + "

Instructions

" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "// Setup", + "function process(num) {", + " return (num + 3) / 5;", + "}", + "", + "// Only change code below this line", + "var processed = 0; // Change this line", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c4", + "title": "Return Early Pattern for Functions", + "description": [ + "Explain how to use return early for functions" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c5", + "title": "Optional Arguments for Functions", + "description": [ + "" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c6", + "title": "Checkpoint: Functions", + "description": [ + "Note: Function Length tips - 10-20 lines, etc" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "cf1111c1c12feddfaeb3bdef", + "title": "Use Conditional Logic with If Statements", + "description": [ + "We can use if statements in JavaScript to only execute code if a certain condition is met.", + "if statements require a boolean condition to evaluate. If the boolean evaluates to true, the statement inside the curly braces executes. If it evaluates to false, the code will not execute.", + "For example:", + "
function test(myVal) {
if (myVal > 10) {
return \"Greater Than\";
}
return \"Not Greater Than\";
}
", + "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", + "

Instructions

Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than 5." + ], + "tests": [ + "assert(typeof myFunction === \"function\", 'message: myFunction should be a function');", + "assert(typeof myFunction(4) === \"string\", 'message: myFunction(4) should return a string');", + "assert(typeof myFunction(6) === \"string\", 'message: myFunction(6) should return a string');", + "assert(myFunction(4) === \"No\", 'message: myFunction(4) should \"No\"');", + "assert(myFunction(5) === \"No\", 'message: myFunction(5) should \"No\"');", + "assert(myFunction(6) === \"Yes\", 'message: myFunction(6) should \"Yes\"');" + ], + "challengeSeed": [ + "// Example", + "function ourFunction(testMe) {", + " if (testMe > 10) { ", + " return \"Yes\";", + " }", + " return \"No\";", + "}", + "", + "// Setup", + "function myFunction(testMe) {", + "", + " // Only change code below this line.", + "", + "", + "", + " // Only change code above this line.", + "", + "}", + "", + "// Change this value to test", + "myFunction(10);" + ], + "solutions": [ + "function myFunction(testMe) {", + " if (testMe > 5) {", + " return 'Yes';", + " }", + " return 'No';", + "}" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244d0", + "title": "Comparison with the Equality Operator", + "description": [ + "There are many Comparison Operators in Javascript. All of these operators return a boolean true or false value.", + "The most basic operators is the equality operator ==. The equality operator compares to values and returns true if they're equivilent or false if they are not. Note that equality is different from assignement (=), which returns the value to the right of the operator.", + "
function equalityTest(myVal) {
if (myVal == 10) {
return \"Equal\";
}
return \"Not Equal\";
}
", + "If myVal is equal to 10, the function will return \"Equal\". If it is not, the function will return \"Not Equal\".", + "The equality operator will do it's best to convert values for comparison, for example:", + "
1 == 1 // true
\"1\" == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
0 == undefined // false
null == undefined // true
", + "

Instructions

Add the equality operator to the indicated line so the function will return \"Equal\" when val is equivilent to 12" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", + "assert(myTest(12) === \"Equal\", 'message: myTest(12) should return \"Equal\"');", + "assert(myTest(\"12\") === \"Equal\", 'message: myTest(\"12\") should return \"Equal\"');", + "assert(editor.getValue().match(/val\\s*==\\s*\\d+/g).length > 0, 'message: You should use the == operator');" + ], + "challengeSeed": [ + "// Setup", + "function myTest(val) {", + " if (val) { // Change this line", + " return \"Equal\";", + " }", + " return \"Not Equal\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "function myTest(val) {", + " if (val == 12) {", + " return \"Equal\";", + " }", + " return \"Not Equal\";", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d1", + "title": "Comparison with the Strict Equality Operator", + "description": [ + "Strict equality (===) is the counterpart to the equality operator (==). Unlike the equality operator, strict equality tests both the type and value of the compared elements.", + "Examples
3 === 3 // true
3 === '3' // false
", + "

Instructions

Change the equality operator to a strict equality on the if statement so the function will return \"Equal\" when val is strictltly equal to 7" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", + "assert(myTest(7) === \"Equal\", 'message: myTest(7) should return \"Equal\"');", + "assert(myTest(\"7\") === \"Not Equal\", 'message: myTest(\"7\") should return \"Not Equal\"');", + "assert(editor.getValue().match(/val\\s*===\\s*\\d+/g).length > 0, 'message: You should use the === operator');" + ], + "challengeSeed": [ + "// Setup", + "function myTest(val) {", + " if (val) { // Change this line", + " return \"Equal\";", + " }", + " return \"Not Equal\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "function myTest(val) {", + " if (val == 7) {", + " return \"Equal\";", + " }", + " return \"Not Equal\";", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d2", + "title": "Comparison with the Inequality Operator", + "description": [ + "The inequality operator (!=) is the opposite of the equality operator. It means \"Not Equal\" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert types.", + "Examples
1 != 2 // true
1 != \"1\" // false
1 != '1' // false
1 != true // false
0 != false // false
", + "

Instructions

Add the inequality operator != to the if statement so the function will return \"Not Equal\" when val is not equivilent to 99" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(99) === \"Equal\", 'message: myTest(99) should return \"Equal\"');", + "assert(myTest(\"99\") === \"Equal\", 'message: myTest(\"99\") should return \"Equal\"');", + "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", + "assert(myTest(\"12\") === \"Not Equal\", 'message: myTest(\"12\") should return \"Not Equal\"');", + "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", + "assert(editor.getValue().match(/val\\s*!=\\s*\\d+/g).length > 0, 'message: You should use the != operator');" + ], + "challengeSeed": [ + "// Setup", + "function myTest(val) {", + " if (val) { // Change this line", + " return \"Not Equal\";", + " }", + " return \"Equal\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "function myTest(val) {", + " if (val != 99) {", + " return \"Not Equal\";", + " }", + " return \"Equal\";", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d3", + "title": "Comparison with the Strict Inequality Operator", + "description": [ + "The inequality operator (!==) is the opposite of the strict equality operator. It means \"Strictly Not Equal\" and returns false where strict equality would return true and vice versa. Strict inequality will not convert types.", + "Examples
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
", + "

Instructions

Add the strict inequality operator to the if statement so the function will return \"Not Equal\" when val is not strictly equal to 17" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(17) === \"Equal\", 'message: myTest(17) should return \"Equal\"');", + "assert(myTest(\"17\") === \"Not Equal\", 'message: myTest(\"17\") should return \"Not Equal\"');", + "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", + "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", + "assert(editor.getValue().match(/val\\s*!==\\s*\\d+/g).length > 0, 'message: You should use the !== operator');" + ], + "challengeSeed": [ + "// Setup", + "function myTest(val) {", + " // Only Change Code Below this Line", + " ", + " if (val) {", + "", + " // Only Change Code Above this Line", + "", + " return \"Not Equal\";", + " }", + " return \"Equal\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "function myTest(val) {", + " if (val != 17) {", + " return \"Not Equal\";", + " }", + " return \"Equal\";", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d4", + "title": "Comparison with the Greater Than Operator", + "description": [ + "The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. If the number on the left is less than or equal to the number on the right, it returns false. Like the equality operator, greater than converts data types.", + "Examples
5 > 3 // true
7 > '3' // true
2 > 3 // false
'1' > 9 // false
", + "

Instructions

Add the greater than operator to the indicated lines so that the return statements make sense." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(0) === \"10 or Under\", 'message: myTest(0) should return \"10 or Under\"');", + "assert(myTest(10) === \"10 or Under\", 'message: myTest(10) should return \"10 or Under\"');", + "assert(myTest(11) === \"Over 10\", 'message: myTest(11) should return \"Over 10\"');", + "assert(myTest(99) === \"Over 10\", 'message: myTest(99) should return \"Over 10\"');", + "assert(myTest(100) === \"Over 10\", 'message: myTest(100) should return \"Over 10\"');", + "assert(myTest(101) === \"Over 100\", 'message: myTest(101) should return \"Over 100\"');", + "assert(myTest(150) === \"Over 100\", 'message: myTest(150) should return \"Over 100\"');\nassert(editor.getValue().match(/val\\s*>\\s*\\d+/g).length > 1, 'message: You should use the > operator at least twice');" + ], + "challengeSeed": [ + "function myTest(val) {", + " if (val) { // Change this line", + " return \"Over 100\";", + " }", + " ", + " if (val) { // Change this line", + " return \"Over 10\";", + " }", + "", + " return \"10 or Under\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "function myTest(val) {", + " if (val > 100) { // Change this line", + " return \"Over 100\";", + " }", + " if (val > 10) { // Change this line", + " return \"Over 10\";", + " }", + " return \"10 or Under\";", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d5", + "title": "Comparison with the Greater Than Equal To Operator", + "description": [ + "The greater than equal to operator (>=) compares the values of two numbers. If the number to the left is greater than or equal the number to the right, it returns true. If the number on the left is less than the number on the right, it returns false. Like the equality operator, greater than equal to converts data types.", + "Examples
6 >= 6 // true
7 >= '3' // true
2 >= 3 // false
'7' >= 9 // false
", + "

Instructions

Add the greater than equal to operator to the indicated lines so that the return statements make sense." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(0) === \"9 or Under\", 'message: myTest(0) should return \"9 or Under\"');", + "assert(myTest(9) === \"9 or Under\", 'message: myTest(9) should return \"9 or Under\"');", + "assert(myTest(10) === \"10 or Over\", 'message: myTest(10) should return \"10 or Over\"');", + "assert(myTest(11) === \"10 or Over\", 'message: myTest(10) should return \"10 or Over\"');", + "assert(myTest(19) === \"10 or Over\", 'message: myTest(19) should return \"10 or Over\"');", + "assert(myTest(20) === \"20 or Over\", 'message: myTest(100) should return \"20 or Over\"');", + "assert(myTest(21) === \"20 or Over\", 'message: myTest(101) should return \"20 or Over\"');", + "assert(editor.getValue().match(/val\\s*>=\\s*\\d+/g).length > 1, 'message: You should use the >= operator at least twice');" + ], + "challengeSeed": [ + "function myTest(val) {", + " if (val) { // Change this line", + " return \"20 or Over\";", + " }", + " ", + " if (val) { // Change this line", + " return \"10 or Over\";", + " }", + "", + " return \"9 or Under\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d6", + "title": "Comparison with the Less Than Operator", + "description": [ + "The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. If the number on the left is greater than or equal to the number on the right, it returns false. Like the equality operator, less than converts data types.", + "Examples
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
", + "

Instructions

Add the less than operator to the indicated lines so that the return statements make sense." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(0) === \"Under 25\", 'message: myTest(0) should return \"Under 25\"');", + "assert(myTest(24) === \"Under 25\", 'message: myTest(24) should return \"Under 25\"');", + "assert(myTest(25) === \"Under 55\", 'message: myTest(25) should return \"Under 55\"');", + "assert(myTest(54) === \"Under 55\", 'message: myTest(54) should return \"Under 55\"');", + "assert(myTest(55) === \"55 or Over\", 'message: myTest(55) should return \"55 or Over\"');", + "assert(myTest(99) === \"55 or Over\", 'message: myTest(99) should return \"55 or Over\"');", + "assert(editor.getValue().match(/val\\s*<\\s*\\d+/g).length > 1, 'message: You should use the < operator at least twice');" + ], + "challengeSeed": [ + "function myTest(val) {", + " if (val) { // Change this line", + " return \"Under 25\";", + " }", + " ", + " if (val) { // Change this line", + " return \"Under 55\";", + " }", + "", + " return \"55 or Over\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d7", + "title": "Comparison with the Less Than Equal To Operator", + "description": [ + "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equl the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", + "Examples
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", + "

Instructions

Add the less than equal to operator to the indicated lines so that the return statements make sense." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(0) === \"Smaller Than 12\", 'message: myTest(0) should return \"Smaller Than 12\"');", + "assert(myTest(11) === \"Smaller Than 12\", 'message: myTest(11) should return \"Smaller Than 12\"');", + "assert(myTest(12) === \"Smaller Than 24\", 'message: myTest(12) should return \"Smaller Than 24\"');", + "assert(myTest(23) === \"Smaller Than 24\", 'message: myTest(23) should return \"Smaller Than 24\"');", + "assert(myTest(24) === \"25 or More\", 'message: myTest(24) should return \"24 or More\"');", + "assert(myTest(55) === \"25 or More\", 'message: myTest(55) should return \"24 or More\"');", + "assert(editor.getValue().match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <= operator at least twice');" + ], + "challengeSeed": [ + "function myTest(val) {", + " if (val) { // Change this line", + " return \"Smaller Than 12\";", + " }", + " ", + " if (val) { // Change this line", + " return \"Smaller Than 24\";", + " }", + "", + " return \"25 or More\";", + "}", + "", + "// Change this value to test", + "myTest(10);", + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d8", + "title": "Comparisons with the Logical And Operator", + "description": [ + "Sometimes you will need to test more than one thing at a time. The logical and operator (&&) returns true if and only if the operands to the left and right of it are true.", + "The same effect could be achieved by nesting an if statement inside another if:", + "
if (num < 10) {
if (num > 5) {
return \"Yes\";
}
}
return \"No\";
Will only return \"Yes\" if num is between 6 and 9. The same logic can be written as:
if (num < 10 && num > 5) {
return \"Yes\";
}
return \"No\";
", + "

Instructions

Combine the two if statements into one statement which returns \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, return \"No\"." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(editor.getValue().match(/&&/g).length === 1, 'message: You should use the && operator once');", + "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(myTest(0) === \"No\", 'message: myTest(0) should return \"No\"');", + "assert(myTest(24) === \"No\", 'message: myTest(24) should return \"No\"');", + "assert(myTest(25) === \"Yes\", 'message: myTest(25) should return \"Yes\"');", + "assert(myTest(49) === \"Yes\", 'message: myTest(30) should return \"Yes\"');", + "assert(myTest(50) === \"Yes\", 'message: myTest(50) should return \"Yes\"');", + "assert(myTest(51) === \"No\", 'message: myTest(51) should return \"No\"');", + "assert(myTest(75) === \"No\", 'message: myTest(75) should return \"No\"');", + "assert(myTest(51) === \"No\", 'message: myTest(51) should return \"No\"');" + ], + "challengeSeed": [ + "function myTest(val) {", + " // Only change code below this line", + "", + " if (val) {", + " if (val) {", + " return \"Yes\";", + "\t }", + " }", + "", + " // Only change code above this line", + " return \"No\";", + "}", + "", + "// Change this value to test", + "myTest(10);" + ], + "solutions": [ + "function myTest(val) {", + " if (val >= 25 && val <= 50) {", + " return \"Yes\";", + " }", + " return \"No\";", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244d9", + "title": "Comparisons with the Logical Or Operator", + "description": [ + "The logical or operator (||) returns true if either ofoperands is true, or false if neither is true.", + "The pattern below should look familiar from prior waypoints:", + "
if (num > 10) {
return \"No\";
}
if (num < 5) {
return \"No\";
}
return \"Yes\";
Will only return \"Yes\" if num is between 5 and 10. The same logic can be written as:
if (num > 10 || num < 5) {
return \"No\";
}
return \"Yes\";
", + "

Instructions

Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(editor.getValue().match(/\\|\\|/g).length === 1, 'message: You should use the || operator once');", + "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(myTest(0) === \"Outside\", 'message: myTest(0) should return \"Outside\"');", + "assert(myTest(9) === \"Outside\", 'message: myTest(9) should return \"Outside\"');", + "assert(myTest(10) === \"Inside\", 'message: myTest(10) should return \"Inside\"');", + "assert(myTest(15) === \"Inside\", 'message: myTest(15) should return \"Inside\"');", + "assert(myTest(19) === \"Inside\", 'message: myTest(19) should return \"Inside\"');", + "assert(myTest(20) === \"Inside\", 'message: myTest(20) should return \"Inside\"');", + "assert(myTest(21) === \"Outside\", 'message: myTest(21) should return \"Outside\"');", + "assert(myTest(25) === \"Outside\", 'message: myTest(25) should return \"Outside\"');" + ], + "challengeSeed": [ + "function myTest(val) {", + " // Only change code below this line", + "", + " if (val) {", + " return \"Outside\";", + " }", + "", + " if (val) {", + " return \"Outside\";", + " }", + "", + " // Only change code above this line", + " return \"Inside\";", + "}", + "", + "// Change this value to test", + "myTest(15);" + ], + "solutions": [ + "function myTest(val) {", + " if (val < 10 || val > 20) {", + " return \"Outside\";", + " }", + " return \"Inside\";", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "5664820f61c48e80c9fa476c", + "title": "Golf Code", + "description": [ + "In the game of golf each hole has a par for the average number of strokes needed to sink the ball. Depending on how far above or below par your stokes are, there is a different nickname.", + "Your function will be passed a par and strokes. Return strings according to this table:", + "
StokesReturn
1\"Hole-in-one!\"
<= par - 2\"Eagle\"
par - 1\"Birdie\"
par\"Par\"
par + 1\"Bogey\"
par + 2\"Double Bogey\"
>= par + 3\"Go Home!\"
", + "par and strokes will always be numeric and positive." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", + "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", + "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", + "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", + "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", + "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", + "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", + "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", + "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", + "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" + ], + "challengeSeed": [ + "function golfScore(par, strokes) {", + " // Only change code below this line", + "", + " ", + " return \"Change Me\";", + " // Only change code above this line", + "}", + "", + "// Change these values to test", + "golfScore(5, 4);" + ], + "solutions": [ + "function golfScore(par, strokes) {", + " if (strokes === 1) {", + " return \"Hole-in-one!\";", + " }", + " ", + " if (strokes <= par - 2) {", + " return \"Eagle\";", + " }", + " ", + " if (strokes === par - 1) {", + " return \"Birdie\";", + " }", + " ", + " if (strokes === par) {", + " return \"Par\";", + " }", + " ", + " if (strokes === par + 1) {", + " return \"Bogey\";", + " }", + " ", + " if(strokes === par + 2) {", + " return \"Double Bogey\";", + " }", + " ", + " return \"Go Home!\";", + "}" + ], + "type": "bonfire", + "challengeType": "5", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244da", + "title": "Introducing Else Statements", + "description": [ + "When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.", + "
if (num > 10) {
return \"Bigger than 10\";
} else {
return \"10 or Less\";
}
", + "

Instructions

Combine the if statements into a single statement." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(/else/g.test(editor.getValue()), 'message: You should use an else statement');", + "assert(myTest(4) === \"5 or Smaller\", 'message: myTest(4) should return \"5 or Smaller\"');", + "assert(myTest(5) === \"5 or Smaller\", 'message: myTest(5) should return \"5 or Smaller\"');", + "assert(myTest(6) === \"Bigger than 5\", 'message: myTest(6) should return \"Bigger than 5\"');", + "assert(myTest(10) === \"Bigger than 5\", 'message: myTest(10) should return \"Bigger than 5\"');", + "assert(/var result = \"\";/.test(editor.getValue()) && /return result;/.test(editor.getValue()), 'message: Do not change the code above or below the lines.');" + ], + "challengeSeed": [ + "function myTest(val) {", + " var result = \"\";", + " // Only change code below this line", + "", + " if(val > 5) {", + " result = \"Bigger than 5\";", + " }", + " ", + " if(val <= 5) {", + " result = \"5 or Smaller\";", + " }", + " ", + " // Only change code above this line", + " return result;", + "}", + " ", + "// Change this value to test", + "myTest(4);", + "" + ], + "solutions": [ + "function myTest(val) {", + " var result = \"\";", + " if(val > 5) {", + " result = \"Bigger than 5\";", + " } else {", + " result = \"5 or Smaller\";", + " }", + " return result;", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244db", + "title": "Introducing Else If Statements", + "description": [ + "If you have multiple conditions that need to be met, you can chain if statements together with else if statements.", + "
if (num > 15) {
return \"Bigger then 15\";
} else if (num < 5) {
return \"Smaller than 5\";
} else {
return \"Between 5 and 15\";
}
", + "

Instructions

Convert the logic to use else if statements." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(editor.getValue().match(/else/g).length > 1, 'message: You should have at least two else statements');", + "assert(editor.getValue().match(/if/g).length > 1, 'message: You should have at least two if statements');", + "assert(myTest(0) === \"Smaller than 5\", 'message: myTest(4) should return \"Smaller than 5\"');", + "assert(myTest(5) === \"Between 5 and 10\", 'message: myTest(5) should return \"Smaller than 5\"');", + "assert(myTest(7) === \"Between 5 and 10\", 'message: myTest(7) should return \"Between 5 and 10\"');", + "assert(myTest(10) === \"Between 5 and 10\", 'message: myTest(10) should return \"Between 5 and 10\"');", + "assert(myTest(12) === \"10 or Bigger\", 'message: myTest(12) should return \"10 or Bigger\"');" + ], + "challengeSeed": [ + "function myTest(val) {", + " if(val > 10) {", + " return \"10 or Bigger\";", + " }", + " ", + " if(val < 5) {", + " return \"Smaller than 5\";", + " }", + " ", + " return \"Between 5 and 10\";", + "}", + " ", + "// Change this value to test", + "myTest(7);", + "" + ], + "solutions": [ + "function myTest(val) {", + " if(val > 10) {", + " return \"10 or Bigger\";", + " } else if(val < 5) {", + " return \"Smaller than 5\";", + " } else {", + " return \"Between 5 and 10\";", + " }", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244dc", + "title": "Chaining If/Else Statements", + "description": [ + "if...else if statements can be chained together for complex logic. Here is pseudocode of multiple chained if/else if statements:", + "
if(condition1) {
statement1
} else if (condition1) {
statement1
} else if (condition3) {
statement3
. . .
} else {
statementN
}
", + "

Instructions

Write chained if/else if statements to fulfill the following conditions:", + "num < 5 - return \"Tiny\"
num < 10 - return \"Small\"
num < 15 - return \"Medium\"
num < 20 - return \"Large\"
num >= 20 - return \"Huge\"" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(editor.getValue().match(/else/g).length > 3, 'message: You should have at least four else statements');", + "assert(editor.getValue().match(/if/g).length > 3, 'message: You should have at least four if statements');", + "assert(editor.getValue().match(/return/g).length === 5, 'message: You should have five return statements');", + "assert(myTest(0) === \"Tiny\", 'message: myTest(0) should return \"Tiny\"');", + "assert(myTest(4) === \"Tiny\", 'message: myTest(4) should return \"Tiny\"');", + "assert(myTest(5) === \"Small\", 'message: myTest(5) should return \"Small\"');", + "assert(myTest(8) === \"Small\", 'message: myTest(8) should return \"Small\"');", + "assert(myTest(10) === \"Medium\", 'message: myTest(10) should return \"Medium\"');", + "assert(myTest(14) === \"Medium\", 'message: myTest(14) should return \"Medium\"');", + "assert(myTest(15) === \"Large\", 'message: myTest(15) should return \"Large\"');", + "assert(myTest(17) === \"Large\", 'message: myTest(17) should return \"Large\"');", + "assert(myTest(20) === \"Huge\", 'message: myTest(20) should return \"Huge\"');", + "assert(myTest(25) === \"Huge\", 'message: myTest(25) should return \"Huge\"');" + ], + "challengeSeed": [ + "function myTest(num) {", + " // Only change code below this line", + "", + "", + " return \"Change Me\";", + " // Only change code above this line", + "}", + "", + "// Change this value to test", + "myTest(7);" + ], + "solutions": [ + "function myTest(num) {", + " if (num < 5) {", + " return \"Tiny\";", + " } else if (num < 10) {", + " return \"Small\";", + " } else if (num < 15) {", + " return \"Medium\";", + " } else if (num < 20) {", + " return \"Large\";", + " } else {", + " return \"Huge\";", + " }", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244dd", + "title": "Selecting from many options with Switch Statements", + "description": [ + "If you have many options to choose from use a switch statement A switch statement tests a value and has many case statements which define that value can be, shown here in pseudocode:", + "
switch (num) {
case value1:
statement1
break;
value2:
statement2;
break;
...
valueN:
statementN;
}
", + "case values are tested with strict equality (===). The break tells Javascript to stop executing statements. If the break is omitted, the next statement will be executed.", + "

Instructions

Write a switch statement to set answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(1) === \"alpha\", 'message: myTest(1) should have a value of \"alpha\"');", + "assert(myTest(2) === \"beta\", 'message: myTest(2) should have a value of \"beta\"');", + "assert(myTest(3) === \"gamma\", 'message: myTest(3) should have a value of \"gamma\"');", + "assert(myTest(4) === \"delta\", 'message: myTest(4) should have a value of \"delta\"');", + "assert(!/else/g.test(editor.getValue()) || !/if/g.test(editor.getValue()), 'message: You should not use any if or else statements');", + "assert(editor.getValue().match(/break/g).length > 2, 'message: You should have at least 3 break statements');" + ], + "challengeSeed": [ + "function myTest(val) {", + " var answer = \"\";", + " // Only change code below this line", + " ", + " ", + "", + " // Only change code above this line ", + " return answer; ", + "}", + "", + "// Change this value to test", + "myTest(1);", + "" + ], + "solutions": [ + "function myTest(val) {", + " var answer = \"\";", + "", + " switch (val) {", + " case 1:", + " answer = \"alpha\";", + " break;", + " case 2:", + " answer = \"beta\";", + " break;", + " case 3:", + " answer = \"gamma\";", + " break;", + " case 4:", + " answer = \"delta\";", + " }", + " return answer; ", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244de", + "title": "Adding a default option in Switch statements", + "description": [ + "In a switch statement you may not be able to specify all possible values as case statements. Instead, you can use the default statement where a case would go. Think of it like an else statement for switch.", + "A default statement should be the last \"case\" in the list.", + "
switch (num) {
case value1:
statement1
break;
value2:
statement2;
break;
...
default:
defaultStatement;
}
", + "

Instructions

Write a switch statement to set answer for the following conditions:
\"a\" - \"apple\"
\"b\" - \"bird\"
\"c\" - \"cat\"
default - \"stuff\"" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(\"a\") === \"apple\", 'message: myTest(\"a\") should have a value of \"apple\"');", + "assert(myTest(\"b\") === \"bird\", 'message: myTest(\"b\") should have a value of \"bird\"');", + "assert(myTest(\"c\") === \"cat\", 'message: myTest(\"c\") should have a value of \"cat\"');", + "assert(myTest(\"d\") === \"stuff\", 'message: myTest(\"d\") should have a value of \"stuff\"');", + "assert(myTest(4) === \"stuff\", 'message: myTest(4) should have a value of \"stuff\"');", + "assert(!/else/g.test(editor.getValue()) || !/if/g.test(editor.getValue()), 'message: You should not use any if or else statements');", + "assert(editor.getValue().match(/break/g).length > 2, 'message: You should have at least 3 break statements');" + ], + "challengeSeed": [ + "function myTest(val) {", + " var answer = \"\";", + " // Only change code below this line", + " ", + " ", + "", + " // Only change code above this line ", + " return answer; ", + "}", + "", + "// Change this value to test", + "myTest(1);", + "" + ], + "solutions": [ + "function myTest(val) {", + " var answer = \"\";", + "", + " switch(val) {", + " case \"a\":", + " answer = \"apple\";", + " break;", + " case \"b\":", + " answer = \"bird\";", + " break;", + " case \"c\":", + " answer = \"cat\";", + " break;", + " default:", + " answer = \"stuff\";", + " }", + " return answer; ", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244df", + "title": "Multiple Identical Options in Switch Statements", + "description": [ + "If the break statement is ommitted from a switch statement case, the following case statement(s). If you have mutiple inputs with the same output, you can represent them in a switch statement like this:", + "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", + "Cases for 1, 2, and 3 will all produce the same result.", + "

Instructions

Write a switch statement to set answer for the following ranges:
1-3 - \"Low\"
4-6 - \"Mid\"
7-9 - \"High\"", + "Note
You will need to have a case statement for each number in the range." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(myTest(1) === \"Low\", 'message: myTest(1) should return \"Low\"');", + "assert(myTest(2) === \"Low\", 'message: myTest(2) should return \"Low\"');", + "assert(myTest(3) === \"Low\", 'message: myTest(3) should return \"Low\"');", + "assert(myTest(4) === \"Mid\", 'message: myTest(4) should return \"Mid\"');", + "assert(myTest(5) === \"Mid\", 'message: myTest(5) should return \"Mid\"');", + "assert(myTest(6) === \"Mid\", 'message: myTest(6) should return \"Mid\"');", + "assert(myTest(7) === \"High\", 'message: myTest(7) should return \"High\"');", + "assert(myTest(8) === \"High\", 'message: myTest(8) should return \"High\"');", + "assert(myTest(9) === \"High\", 'message: myTest(9) should return \"High\"');", + "assert(!/else/g.test(editor.getValue()) || !/if/g.test(editor.getValue()), 'message: You should not use any if or else statements');", + "assert(editor.getValue().match(/case/g).length === 9, 'message: You should have nine case statements');" + ], + "challengeSeed": [ + "function myTest(val) {", + " var answer = \"\";", + " // Only change code below this line", + " ", + " ", + "", + " // Only change code above this line ", + " return answer; ", + "}", + "", + "// Change this value to test", + "myTest(1);", + "" + ], + "solutions": [ + "function myTest(val) {", + " var answer = \"\";", + " ", + " switch (val) {", + " case 1:", + " case 2:", + " case 3:", + " answer = \"Low\";", + " break;", + " case 4:", + " case 5:", + " case 6:", + " answer = \"Mid\";", + " break;", + " case 7:", + " case 8:", + " case 9:", + " answer = \"High\";", + " }", + " ", + " return answer; ", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244e0", + "title": "Replacing If/Else chains with Switch", + "description": [ + "If you have many options to choose from, a switch statement can be easier to write than many chained if/if else statements. The following:", + "
if(val === 1) {
answer = \"a\";
} else if(val === 2) {
answer = \"b\";
} else {
answer = \"c\";
}
", + "can be replaced with:", + "
switch (val) {
case 1:
answer = \"a\";
break;
case 2:
answer = \"b\";
break;
default:
answer = \"c\";
}
", + "

Instructions

Change the chained if/if else statements into a switch statement." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(!/else/g.test(editor.getValue()), 'message: You should not use any else statements');", + "assert(!/if/g.test(editor.getValue()), 'message: You should not use any if statements');", + "assert(editor.getValue().match(/break/g).length === 4, 'message: You should have four break statements');", + "assert(myTest(\"bob\") === \"Marley\", 'message: myTest(\"bob\") should be \"Marley\"');", + "assert(myTest(42) === \"The Answer\", 'message: myTest(42) should be \"The Answer\"');", + "assert(myTest(1) === \"There is no #1\", 'message: myTest(1) should be \"There is no #1\"');", + "assert(myTest(99) === \"Missed me by this much!\", 'message: myTest(99) should be \"Missed me by this much!\"');", + "assert(myTest(7) === \"Ate Nine\", 'message: myTest(7) should be \"Ate Nine\"');" + ], + "challengeSeed": [ + "function myTest(val) {", + " var answer = \"\";", + " // Only change code below this line", + " ", + " if(val === \"bob\") {", + " answer = \"Marley\";", + " } else if(val === 42) {", + " answer = \"The Answer\";", + " } else if(val === 1) {", + " answer = \"There is no #1\";", + " } else if(val === 99) {", + " answer = \"Missed me by this much!\";", + " } else if(val === 7) {", + " answer = \"Ate Nine\";", + " }", + "", + " // Only change code above this line ", + " return answer; ", + "}", + "", + "// Change this value to test", + "myTest(7);", + "" + ], + "solutions": [ + "function myTest(val) {", + " var answer = \"\";", + "", + " switch (val) {", + " case \"bob\":", + " answer = \"Marley\";", + " break;", + " case 42:", + " answer = \"The Answer\";", + " break;", + " case 1:", + " answer = \"There is no #1\";", + " break;", + " case 99:", + " answer = \"Missed me by this much!\";", + " break;", + " case 7:", + " answer = \"Ate Nine\";", + " }", + " return answer; ", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "565bbe00e9cc8ac0725390f4", + "title": "Counting Cards", + "description": [ + "In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called Card Counting. ", + "Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.", + "
ValueCards
+12, 3, 4, 5, 6
07, 8, 9
-110, 'J', 'Q', 'K','A'
", + "You will write a card counting function. It will recieve a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count if positive, or \"Hold\" if the count is zero or negative.", + "Example Output", + "-3 Hold
5 Bet" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === \"5 Bet\") {return true;} return false; })(), 'message: Cards Sequence 2, 3, 4, 5, 6 should return \"5 Bet\"');", + "assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === \"0 Hold\") {return true;} return false; })(), 'message: Cards Sequence 7, 8, 9 should return \"0 Hold\"');", + "assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === \"-5 Hold\") {return true;} return false; })(), 'message: Cards Sequence 10, J, Q, K, A should return \"-5 Hold\"');", + "assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === \"-1 Hold\") {return true;} return false; })(), 'message: Cards Sequence 3, 2, A, 10, K should return \"-1 Hold\"');" + ], + "challengeSeed": [ + "var count = 0;", + "", + "function cc(card) {", + " // Only change code below this line", + "", + "", + " return \"Change Me\";", + " // Only change code above this line", + "}", + "", + "// Add/remove calls to test your function. ", + "// Note: Only the last will display", + "cc(2); cc(3); cc(7); cc('K'); cc('A');" + ], + "solutions": [ + "var count = 0;", + "function cc(card) {", + " switch(card) {", + " case 2:", + " case 3:", + " case 4:", + " case 5:", + " case 6:", + " count++;", + " break;", + " case 10:", + " case 'J':", + " case 'Q':", + " case 'K':", + " case 'A':", + " count--;", + " }", + " if(count > 0) {", + " return count + \" Bet\";", + " } else {", + " return count + \" Hold\";", + " }", + "}" + ], + "type": "bonfire", + "challengeType": "5", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "bg9998c9c99feddfaeb9bdef", @@ -861,24 +3215,19 @@ "You may have heard the term object before.", "Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties.", "Here's a sample object:", - "var cat = {", - "  \"name\": \"Whiskers\",", - "  \"legs\": 4,", - "  \"tails\": 1,", - "  \"enemies\": [\"Water\", \"Dogs\"]", - "};", - "
", + "
var cat = {
\"name\": \"Whiskers\",
\"legs\": 4,
\"tails\": 1,
\"enemies\": [\"Water\", \"Dogs\"]
};
", "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\" (a string), \"legs\", \"tails\" and \"friends\".", + "

Instructions

Make an object that represents a dog called myDog which contains the properties \"name\" (a string), \"legs\", \"tails\" and \"friends\".", "You can set these object properties to whatever values you want, as long \"name\" is a string, \"legs\" and \"tails\" are numbers, and \"friends\" is an array." ], "tests": [ - "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof z.name === \"string\"){return true;}else{return false;}})(myDog), 'message: 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), 'message: 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), 'message: myDog should contain the property tails and it should be a number.');", + "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'message: 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), 'message: 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), 'message: 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), 'message: myDog should contain the property friends and it should be an array.');" ], "challengeSeed": [ + "// Example", "var ourDog = {", " \"name\": \"Camper\",", " \"legs\": 4,", @@ -893,51 +3242,182 @@ "", "", "", - "};", - "", - "// Only change code above this line.", - "", + "};" + ], + "tail": [ "(function(z){return z;})(myDog);" ], + "solutions": [ + "" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Construye objetos en JavaScript", - "descriptionEs": [ - "Es posible que haya oído el término objeto antes.", - "Los objetos son similares a los vectores, excepto que en lugar de utilizar los índices para acceder y modificar sus datos, pueden accederse mediante lo que se llama propiedades.", - "Esto es un objeto de ejemplo:", - "var cat = {", - "  \"name\": \"Whiskers\",", - "  \"legs\": 4,", - "  \"tails\": 1,", - "  \"enemies\": [\"Water\", \"Dogs\"]", - "};", - "Los objetos son útiles para almacenar datos de manera estructurada, y pueden representar objetos del mundo real, como un gato.", - "Vamos a tratar de hacer un objeto que representa un perro, lo llamaremos mydog y contendrá las propiedades \"name\" (una cadena con el nombre), \"legs\" (piernas), \"tails\" (colas) y \"friends\" (amigos). ", - "Podrás establecer estas propiedades del objeto en los valores que desees, siempre y cuando \"name\" sea una cadena, \"legs\" y \"tails\" sean números, y \"friends\" sea un vector." - ] + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244c7", + "title": "Accessing Objects Properties with the Dot Operator", + "description": [ + "There are two ways to access the properties of an object: the dot operator (.) and bracket notation ([]), similar to an array.", + "The dot operator is what you use when you know the name of the property you're trying to access ahead of time.", + "Here is a sample of using the . to read an object property:", + "
var myObj = {
prop1: \"val1\",
prop2: \"val2\"
};
myObj.prop1; // val1
myObj.prop2; // val2
", + "

Instructions

Read the values of the properties hat and shirt of testObj using dot notation." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof hatValue === 'string' , 'message: hatValue should be a string');", + "assert(hatValue === 'ballcap' , 'message: The value of hatValue should be \"ballcap\"');", + "assert(typeof shirtValue === 'string' , 'message: shirtValue should be a string');", + "assert(shirtValue === 'jersey' , 'message: The value of shirtValue should be \"jersey\"');\nassert(editor.getValue().match(/testObj\\.\\w+/g).length > 1, 'message: You should use dot notation twice');" + ], + "challengeSeed": [ + "// Setup", + "var testObj = {", + " \"hat\": \"ballcap\",", + " \"shirt\": \"jersey\",", + " \"shoes\": \"cleats\"", + "};", + "", + "// Only change code below this line", + "", + "var hatValue = testObj; // Change this line", + "var shirtValue = testObj; // Change this line" + ], + "tail": [ + "(function(a,b) { return \"hatValue = '\" + a + \"', shirtValue = '\" + b + \"'\"; })(hatValue,shirtValue);" + ], + "solutions": [ + "var testObj = {", + " \"hat\": \"ballcap\",", + " \"shirt\": \"jersey\",", + " \"shoes\": \"cleats\"", + "};", + "", + "var hatValue = testObj.hat; ", + "var shirtValue = testObj.shirt;" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c8", + "title": "Accessing Objects Properties with Bracket Notation", + "description": [ + "The second way to access the properties of an objectis bracket notation ([]). If the property of the object you are trying to access has a space in it, you will need to use bracket notation.", + "Here is a sample of using bracket notation to read an object property:", + "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", + "Note that property names with spaces in them must be in quotes (single or double).", + "

Instructions

Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof entreeValue === 'string' , 'message: entreeValue should be a string');", + "assert(entreeValue === 'hamburger' , 'message: The value of entreeValue should be \"hamburger\"');", + "assert(typeof drinkValue === 'string' , 'message: drinkValue should be a string');", + "assert(drinkValue === 'water' , 'message: The value of drinkValue should be \"water\"');", + "assert(editor.getValue().match(/testObj\\[('|\")[^'\"]+\\1\\]/g).length > 1, 'message: You should use bracket notation twice');" + ], + "challengeSeed": [ + "// Setup", + "var testObj = {", + " \"an entree\": \"hamburger\",", + " \"my side\": \"veggies\",", + " \"the drink\": \"water\"", + "};", + "", + "// Only change code below this line", + "", + "var entreeValue = testObj; // Change this line", + "var drinkValue = testObj; // Change this line" + ], + "tail": [ + "(function(a,b) { return \"entreeValue = '\" + a + \"', shirtValue = '\" + b + \"'\"; })(entreeValue,drinkValue);" + ], + "solutions": [ + "var testObj = {", + " \"an entree\": \"hamburger\",", + " \"my side\": \"veggies\",", + " \"the drink\": \"water\"", + "};", + "var entreeValue = testObj[\"an entree\"];", + "var drinkValue = testObj['the drink'];" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c9", + "title": "Accessing Objects Properties with Variables", + "description": [ + "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for itterating through lists of object properties or for doing lookups.", + "Here is an example of using a variable to access a property:", + "
var someProp = \"propName\";
var myObj = {
propName: \"Some Value\"
}
myObj[someProp]; // \"Some Value\"
", + "Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name", + "

Instructions

Use the playerNumber variable to lookup player 16 in testObj using bracket notation." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(typeof playerNumber === 'number', 'message: playerNumber should be a number');", + "assert(typeof player === 'string', 'message: The variable player should be a string');", + "assert(player === 'Montana', 'message: The value of player should be \"Montana\"');", + "assert(/testObj\\[\\s*playerNumber\\s*\\]/.test(editor.getValue()),'message: You should use bracket notation to access testObj');" + ], + "challengeSeed": [ + "// Setup", + "var testObj = {", + " 12: \"Namath\",", + " 16: \"Montana\",", + " 19: \"Unitas\"", + "};", + "", + "// Only change code below this line;", + "", + "var playerNumber; // Change this Line", + "var player = testObj; // Change this Line" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "bg9999c9c99feddfaeb9bdef", - "title": "Update the Properties of a JavaScript Object", + "title": "Updating Object Properties", "description": [ - "After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable.", + "After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable. You can use either dot or bracket notation to update.", "For example, let's look at ourDog:", - "var ourDog = {", - "  \"name\": \"Camper\",", - "  \"legs\": 4,", - "  \"tails\": 1,", - "  \"friends\": [\"everything!\"]", - "};", + "
var ourDog = {
\"name\": \"Camper\",
\"legs\": 4,
\"tails\": 1,
\"friends\": [\"everything!\"]
};
", "Since he's a particularly happy dog, let's change his name to \"Happy Camper\". Here's how we update his object's name property:", - "ourDog.name = \"Happy Camper\";", - "Now when we run return ourDog.name, instead of getting \"Camper\", we'll get his new name, \"Happy Camper\".", - "Let's update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\"." + "ourDog.name = \"Happy Camper\"; or", + "outDog[\"name\"] = \"Happy Camper\";", + "Now when we evaluate ourDog.name, instead of getting \"Camper\", we'll get his new name, \"Happy Camper\".", + "

Instructions

Update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\". You can use either dot or bracket notation." ], "tests": [ - "assert(/happy coder/gi.test(myDog.name), 'message: Update myDog's \"name\" property to equal \"Happy Coder\".');" + "assert(/happy coder/gi.test(myDog.name), 'message: Update myDog's \"name\" property to equal \"Happy Coder\".');", + "assert(/\"name\": \"Coder\"/.test(editor.getValue()), 'message: Do not edit the myDog definition');" ], "challengeSeed": [ + "// Example", "var ourDog = {", " \"name\": \"Camper\",", " \"legs\": 4,", @@ -947,6 +3427,7 @@ "", "ourDog.name = \"Happy Camper\";", "", + "// Setup", "var myDog = {", " \"name\": \"Coder\",", " \"legs\": 4,", @@ -956,44 +3437,32 @@ "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", + "" + ], + "tail": [ "(function(z){return z;})(myDog);" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Actualiza las propiedades de un objeto en JavaScript", - "descriptionEs": [ - "Después de que hayas creado un objeto de JavaScript, puedes actualizar sus propiedades en cualquier momento, tal y como harías con cualquier otra variable.", - "Por ejemplo, echemos un vistazo a ourDog:", - "var ourDog = {", - "  \"name\": \"Camper\",", - "  \"legs\": 4,", - "  \"tails\": 1,", - "  \"friends\": [\"everything!\"]", - "};", - "Dado que es un perro particularmente feliz, vamos a cambiar su nombre a \"Happy Camper\". Así es como actualizamos la propiedad nombre del objeto: ", - "ourDog.name = \"Happy Camper\";", - "Ahora, cuando ejecutemos return ourDog.name, en lugar de obtener \"Camper\", vamos a recibir su nuevo nombre, \"Happy Camper\".", - "Vamos a actualizar la propiedad del objeto mydog. Cambiemos su nombre de \"Coder\" a \"Happy Coder\"." - ] + "challengeType": "1" }, { "id": "bg9999c9c99feedfaeb9bdef", "title": "Add New Properties to a JavaScript Object", "description": [ - "You can add new properties to existing JavaScript objects the same way you would modify them.", + "You can add new properties to existing JavaScript objects the same way you would modify them. ", "Here's how we would add a \"bark\" property to ourDog:", - "ourDog.bark = \"bow-wow\";", - "Now when we run return ourDog.bark, we'll get his bark, \"bow-wow\".", - "Let's add a \"bark\" property to myDog and set it to a dog sound, such as \"woof\"." + "ourDog.bark = \"bow-wow\"; ", + "or", + "ourDog[\"bark\"] = \"bow-wow\";", + "Now when we evaluate ourDog.bark, we'll get his bark, \"bow-wow\".", + "

Instructions

Add a \"bark\" property to myDog and set it to a dog sound, such as \"woof\". You may use either dot or bracket notation." ], "tests": [ - "assert(myDog.bark !== undefined, 'message: Add the property \"bark\" to myDog.');" + "assert(myDog.bark !== undefined, 'message: Add the property \"bark\" to myDog.');", + "assert(!/bark[^\\n]:/.test(editor.getValue()), 'message: Do not add \"bark\" to the setup section');" ], "challengeSeed": [ + "// Example", "var ourDog = {", " \"name\": \"Camper\",", " \"legs\": 4,", @@ -1003,6 +3472,7 @@ "", "ourDog.bark = \"bow-wow\";", "", + "// Setup", "var myDog = {", " \"name\": \"Happy Coder\",", " \"legs\": 4,", @@ -1011,23 +3481,22 @@ "};", "", "// Only change code below this line.", - "", - "", - "", - "// Only change code above this line.", - "", + "" + ], + "tail": [ "(function(z){return z;})(myDog);" ], + "solutions": [ + "var myDog = {", + " \"name\": \"Happy Coder\",", + " \"legs\": 4,", + " \"tails\": 1,", + " \"friends\": [\"Free Code Camp Campers\"]", + "};", + "myDog.bark = \"Woof Woof\";" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Añade nuevas propiedades a un objeto JavaScript", - "descriptionEs": [ - "Puedes añadir nuevas propiedades a objetos existente de la misma forma que usarías para modificarlos.", - "Así es como añadimos una propiedad \"bark\" (ladra) a nuestro objeto ourDog:", - "ourDog.bark = \"bow-wow\";", - "Ahora, cuando ejecutemos return ourDog.bark, vamos a recbir su ladrido, \" bow-wow \".", - "Vamos a añadir una propiedad ladra a myDog y a ponerle un sonido de perro, tal como \"woof\"." - ] + "challengeType": "1" }, { "id": "bg9999c9c99fdddfaeb9bdef", @@ -1035,12 +3504,14 @@ "description": [ "We can also delete properties from objects like this:", "delete ourDog.bark;", - "Let's delete the \"tails\" property from myDog." + "

Instructions

Delete the \"tails\" property from myDog. You may use either dot or bracket notation." ], "tests": [ - "assert(myDog.tails === undefined, 'message: Delete the property \"tails\" from myDog.');" + "assert(myDog.tails === undefined, 'message: Delete the property \"tails\" from myDog.');", + "assert(editor.getValue().match(/\"tails\": 1/g).length > 1, 'message: Do not modify the myDog setup');" ], "challengeSeed": [ + "// Example", "var ourDog = {", " \"name\": \"Camper\",", " \"legs\": 4,", @@ -1051,6 +3522,7 @@ "", "delete ourDog.bark;", "", + "// Setup", "var myDog = {", " \"name\": \"Happy Coder\",", " \"legs\": 4,", @@ -1061,20 +3533,364 @@ "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", + "" + ], + "tail": [ "(function(z){return z;})(myDog);" ], + "solutions": [ + "// Setup", + "var myDog = {", + " \"name\": \"Happy Coder\",", + " \"legs\": 4,", + " \"tails\": 1,", + " \"friends\": [\"Free Code Camp Campers\"],", + " \"bark\": \"woof\"", + "};", + "delete myDog.tails;" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Elimina propiedades de un objeto JavaScript", - "descriptionEs": [ - "También podemos eliminar propiedades de los objetos de esta manera:", - "delete ourDog.bark;", - "Borremos la propiedad \"tails\" de myDog." - ] + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244ca", + "title": "Using Objects for Lookups", + "description": [ + "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if...else chain. This is most useful when you know that your input data is limited to a certain range.", + "Here is an example of a simple reverse alphabet lookup:", + "
var alpha = {
1:\"Z\"
2:\"Y\"
3:\"X\"
...
4:\"W\"
24:\"C\"
25:\"B\"
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", + "

Instructions

Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(numberLookup(0) === 'zero', 'message: numberLookup(0) should equal \"zero\"');", + "assert(numberLookup(1) === 'one', 'message: numberLookup(1) should equal \"one\"');", + "assert(numberLookup(2) === 'two', 'message: numberLookup(2) should equal \"two\"');", + "assert(numberLookup(3) === 'three', 'message: numberLookup(3) should equal \"three\"');", + "assert(numberLookup(4) === 'four', 'message: numberLookup(4) should equal \"four\"');", + "assert(numberLookup(5) === 'five', 'message: numberLookup(5) should equal \"five\"');", + "assert(numberLookup(6) === 'six', 'message: numberLookup(6) should equal \"six\"');", + "assert(numberLookup(7) === 'seven', 'message: numberLookup(7) should equal \"seven\"');", + "assert(numberLookup(8) === 'eight', 'message: numberLookup(8) should equal \"eight\"');", + "assert(numberLookup(9) === 'nine', 'message: numberLookup(9) should equal \"nine\"');", + "assert(!/case|switch|if/g.test(editor.getValue()), 'message: You should not use case, switch, or if statements');" + ], + "challengeSeed": [ + "// Setup", + "function numberLookup(val) {", + " var result = \"\";", + "", + " // Only change code below this line", + " switch(val) {", + " case 0: ", + " result = \"zero\";", + " break;", + " case 1: ", + " result = \"one\";", + " break;", + " case 2: ", + " result = \"two\";", + " break;", + " case 3: ", + " result = \"three\";", + " break;", + " case 4: ", + " result = \"four\";", + " break;", + " case 5: ", + " result = \"five\";", + " break;", + " case 6: ", + " result = \"six\";", + " break;", + " case 7: ", + " result = \"seven\";", + " break;", + " case 8: ", + " result = \"eight\";", + " break;", + " case 9: ", + " result = \"nine\";", + " break;", + " }", + "", + " // Only change code above this line", + " return result;", + "}", + "", + "" + ], + "solutions": [ + "function numberLookup(val) {", + " var result = \"\";", + "", + " var lookup = {", + " 0:\"zero\",", + " 1:\"one\",", + " 2:\"two\",", + " 3:\"three\",", + " 4:\"four\",", + " 5:\"five\",", + " 6:\"six\",", + " 7:\"seven\",", + " 8:\"eight\",", + " 9:\"nine\"", + " };", + " result = lookup[val];", + "", + " return result;", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244cb", + "title": "Introducing JavaScript Object Notation (JSON)", + "description": [ + "JavaScript Object Notation or JSON uses the format of Javascript Objects to store data. JSON is flexible becuase it allows for data structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects. ", + "Here is an example of a JSON object:", + "
var ourMusic = [
{
\"artist\": \"Daft Punk\",
\"title\": \"Homework\",
\"release_year\": 1997,
\"formats\": [
\"CD\",
\"Cassette\",
\"LP\" ],
\"gold\": true
}
];
", + "This is an array of objects and the object has various peices of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", + "

Instructions

Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(Array.isArray(myMusic), 'message: myMusic should be an array');", + "assert(myMusic.length > 1, 'message: myMusic should have at least two elements');", + "assert(typeof myMusic[1] === 'object', 'message: myMusic[1] should be an object');", + "assert(Object.keys(myMusic[1]).length > 3, 'message: myMusic[1] should have at least 4 properties');", + "assert(myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string', 'message: myMusic[1] should contain an artist property which is a string');", + "assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string', 'message: myMusic[1] should contain a title property which is a string');", + "assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number', 'message: myMusic[1] should contain a release_year property which is a number');", + "assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats), 'message: myMusic[1] should contain a formats property which is an array');", + "assert(typeof myMusic[1].formats[0] === 'string' && myMusic[1].formats.length > 1, 'message: formats should be an array of strings with at least two elements');" + ], + "challengeSeed": [ + "var myMusic = [", + " {", + " \t\"artist\": \"Billy Joel\",", + " \"title\": \"Piano Man\",", + " \"release_year\": 1993,", + " \"formats\": [ ", + " \"CS\", ", + " \"8T\", ", + " \"LP\" ],", + " \"gold\": true", + " }", + " // Add record here", + "];", + "" + ], + "tail": [ + "(function(x){ if (Array.isArray(x)) { return JSON.stringify(x); } return \"myMusic is not an array\"})(myMusic);" + ], + "solutions": [ + "var myMusic = [", + " {", + " \t\"artist\": \"Billy Joel\",", + " \"title\": \"Piano Man\",", + " \"release_year\": 1993,", + " \"formats\": [ ", + " \"CS\", ", + " \"8T\", ", + " \"LP\" ],", + " \"gold\": true", + " }, ", + " {", + " \"artist\": \"ABBA\",", + " \"title\": \"Ring Ring\",", + " \"release_year\": 1973,", + " \"formats\": [ ", + " \"CS\", ", + " \"8T\", ", + " \"LP\",", + "\t \"CD\",", + "\t]", + " }", + "}", + " // Add record here", + "];" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244cc", + "title": "Accessing Nested Objects in JSON", + "description": [ + "The properties and sub-properties of JSON objects can be accessed by chaining together the dot or bracket notation.", + "Here is a nested JSON Object:", + "
var ourStorage = {
\"desk\": {
\"drawer\": \"stapler\"
},
\"cabinet\": {
\"top drawer\": {
\"folder1\": \"a file\",
\"folder2\": \"secrets\"
},
\"bottom drawer\": \"soda\"
}
}
ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"
ourStoage.desk.drawer; // \"stapler\"
", + "

Instructions

Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(gloveBoxContents === \"maps\", 'message: gloveBoxContents should equal \"maps\"');", + "assert(/=\\s*myStorage\\.car\\.inside\\[([\"'])glove box\\1\\]/.test(editor.getValue()), 'message: Use dot and bracket notation to access myStorage');" + ], + "challengeSeed": [ + "// Setup", + "var myStorage = {", + " \"car\": {", + " \"inside\": {", + " \"glove box\": \"maps\",", + " \"passenger seat\": \"crumbs\"", + " },", + " \"outside\": {", + " \"trunk\": \"jack\"", + " }", + " }", + "};", + "", + "// Only change code below this line", + "", + "var gloveBoxContents = \"\"; // Change this line", + "" + ], + "tail": [ + "(function(x) { if(typeof gloveBoxContents != 'undefined') { return \"gloveBoxContents = \", x} else return \"gloveBoxContents is undefined\";})(gloveBoxContents);" + ], + "solutions": [ + "var myStorage = {", + " \"car\": {", + " \"inside\": {", + " \"glove box\": \"maps\",", + " \"passenger seat\": \"crumbs\"", + " },", + " \"outside\": {", + " \"trunk\": \"jack\"", + " }", + " }", + "};", + "var gloveBoxContents = myStorage.car.inside['glove box']; // Change this line" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244cd", + "title": "Accessing Nested Arrays in JSON", + "description": [ + "As we have seen in earlier examples, JSON objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.", + "Here is an example of how to access a nested array:", + "
var ourPets = {
\"cats\": [
\"Meowzer\",
\"Fluffy\",
\"Kit-Cat\"
],
\"dogs:\" [
\"Spot\",
\"Bowser\",
\"Frankie\"
]
};
ourPets.cats[1]; // \"Fluffy\"
ourPets.dogs[0]; // \"Spot\"
", + "

Instructions

Retrieve the second tree using object dot and array bracket notation." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(secondTree === \"pine\", 'message: secondTree should equal \"pine\"');", + "assert(/=\\s*myPlants\\[1\\].list\\[1\\]/.test(editor.getValue()), 'message: Use dot and bracket notation to access myPlants');" + ], + "challengeSeed": [ + "// Setup", + "var myPlants = [", + " { ", + " type: \"flowers\",", + " list: [", + " \"rose\",", + " \"tulip\",", + " \"dandelion\"", + " ]", + " },", + " {", + " type: \"trees\",", + " list: [", + " \"fir\",", + " \"pine\",", + " \"birch\"", + " ]", + " } ", + "];", + "", + "// Only change code below this line", + "", + "var secondTree = \"\"; // Change this line", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244ce", + "title": "Arbitrary Nesting in JSON", + "description": [ + "Retrieve a value from an arbitary JSON" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244cf", + "title": "Checkpoint: Objects", + "description": [ + "" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "cf1111c1c11feddfaeb5bdef", @@ -1088,54 +3904,34 @@ "The condition statement is evaluated at the beginning of every loop iteration and will continue as long as it evalutes to true. When condition is false at the start of the iteration, the loop will stop executing. This means if condition starts as false, your loop will never execute.", "The final-expression is executed at the end of each loop iteration, prior to the next condition check and is usually used to increment or decrement your loop counter.", "In the following example we initialize with i = 0 and iterate while our condition i < 5 is true. We'll increment i by 1 in each loop iteration with i++ as our final-expression.", - "var ourArray = [];", - "for (var i = 0; i < 5; i++) {", - "  ourArray.push(i);", - "}", + "
var ourArray = [];
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
", "ourArray will now contain [0,1,2,3,4].", - "Let's use a for loop to work to push the values 1 through 5 onto myArray." + "

Instructions

Use a for loop to work to push the values 1 through 5 onto myArray." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", "assert.deepEqual(myArray, [1,2,3,4,5], 'message: myArray should equal [1,2,3,4,5].');" ], "challengeSeed": [ + "// Example", "var ourArray = [];", "", "for (var i = 0; i < 5; i++) {", " ourArray.push(i);", "}", "", + "// Setup", "var myArray = [];", "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", - "if(typeof myArray !== \"undefined\"){(function(){return myArray;})();}", "" ], + "tail": [ + "if (typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Iterar con JavaScript en ciclos", - "descriptionEs": [ - "Puede ejecutar el mismo código varias veces mediante el uso de un ciclo.", - "El tipo más común de bucle de JavaScript se llama \"ciclo for\"porque se ejecuta \"por\" (for) un número específico de veces.", - "Los ciclos for se declaran con tres expresiones opcionales separadas por punto y coma:", - "for ([inicialización]; [condición]; [expresión-final])", - "La inicialización se ejecuta sólo una vez antes de que empiece el ciclo. Normalmente se utiliza para definir e inicializar su variable de ciclo. ", - "La expresión condición se evalúa al principio de cada iteración del ciclo y continuará en el ciclo siempre y cuando sea verdadera (true). Cuando la condición sea falsa (false) al comienzo de la iteración, se detendrá la ejecución del ciclo. Esto significa que si la condición inicia en el valor falso false, el ciclo no se ejecutará. ", - "La expresión final se ejecuta al final de cada repetición del ciclo, antes del siguiente chequeo de la condición y se utiliza generalmente para aumentar o disminuir el contador del ciclo.", - "En el siguiente ejemplo inicializamos con i = 0 e iteramos mientras nuestra condición i <5 sea verdadera. Vamos a incrementar i en 1 en cada iteración del ciclo con i++ como nuestra expresión final. ", - "var ourArray = [];", - "for (var i = 0; i < 5; i++) {", - "  ourArray.push(i);", - "}", - "ourArray ahora contendrá [0,1,2,3,4].", - "Vamos a utilizar un ciclo for para empujar los valores del 1 al 5 en myArray." - ] + "challengeType": "1" }, { "id": "56104e9e514f539506016a5c", @@ -1143,50 +3939,35 @@ "description": [ "For loops don't have to iterate one at a time. By changing our final-expression, we can count by even numbers.", "We'll start at i = 0 and loop while i < 10. We'll increment i by 2 each loop with i += 2.", - "var ourArray = [];", - "for (var i = 0; i < 10; i += 2) {", - "  ourArray.push(i);", - "}", + "
var ourArray = [];
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
", "ourArray will now contain [0,2,4,6,8].", - "Let's change our initialization and final-expression so we can count by odd numbers.", - "Push the odd numbers from 1 through 9 to myArray using a for loop." + "Let's change our initialization so we can count by odd numbers.", + "

Instructions

Push the odd numbers from 1 through 9 to myArray using a for loop." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", "assert.deepEqual(myArray, [1,3,5,7,9], 'message: myArray should equal [1,3,5,7,9].');" ], "challengeSeed": [ + "// Example", "var ourArray = [];", "", "for (var i = 0; i < 10; i += 2) {", " ourArray.push(i);", "}", "", + "// Setup", "var myArray = [];", "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", - "if(typeof myArray !== \"undefined\"){(function(){return myArray;})();}", "" ], + "tail": [ + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" + ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Itera por los números pares con un ciclo for", - "descriptionEs": [ - "Los ciclos for no siempre iteran incrementado de a uno. Cambiando nuestra expresión final, podemos contar los números pares.", - "Vamos a empezar con i = 0 e iterar mientras i <10. Vamos a incrementar i de a 2 en cada iteración i + = 2. ", - "var ourArray = [];", - "for (var i = 0; i < 10; i += 2) {", - "  ourArray.push(i);", - "}", - "ourArray ahora contendrá [0,2,4,6,8].", - "Vamos a cambiar nuestra inicialización y expresión final para que podamos contar los números impares.", - "Empuja los números impares del 1 al 9 en myArray utilizando un ciclo for." - ] + "challengeType": "1" }, { "id": "56105e7b514f539506016a5e", @@ -1195,50 +3976,115 @@ "A for loop can also count backwards, so long as we can define the right conditions.", "In order to count backwards by twos, we'll need to change our initialization, condition, and final-expression.", "We'll start at i = 10 and loop while i > 0. We'll decrement i by 2 each loop with i -= 2.", - "var ourArray = [];", - "for (var i = 10; i > 0; i -= 2) {", - "  ourArray.push(i);", - "}", + "
var ourArray = [];
for (var i=10; i > 0; i-=2) {
ourArray.push(i);
}
", "ourArray will now contain [10,8,6,4,2].", "Let's change our initialization and final-expression so we can count backward by twos by odd numbers.", - "Push the odd numbers from 9 through 1 to myArray using a for loop." + "

Instructions

Push the odd numbers from 9 through 1 to myArray using a for loop." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", "assert.deepEqual(myArray, [9,7,5,3,1], 'message: myArray should equal [9,7,5,3,1].');" ], "challengeSeed": [ + "// Example", "var ourArray = [];", "", "for (var i = 10; i > 0; i -= 2) {", " ourArray.push(i);", "}", "", + "// Setup", "var myArray = [];", "", "// Only change code below this line.", + "" + ], + "tail": [ + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" + ], + "type": "waypoint", + "challengeType": "1" + }, + { + "id": "5675e877dbd60be8ad28edc6", + "title": "Iterate Through an Array with a For Loop", + "description": [ + "A common task in Javascript is to iterate through the contents of an array. One way to do that is with a for loop. This code will output each element of the array arr to the console:", + "
var arr = [10,9,8,7,6];
for (var i=0; i < arr.length; i++) {
console.log(arr[i]);
}
", + "Remember that Arrays have zero-based numbering, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops when i is at length - 1.", + "

Instructions

Create a variable total. Use a for loop to add each element of myArr to total." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(total !== 'undefined', 'message: total should be defined');", + "assert(total === 20, 'message: total should equal 20');", + "assert(!/20/.test(editor.getValue()), 'message: Do not set total to 20 directly');" + ], + "challengeSeed": [ + "// Example", + "var ourArr = [ 9, 10, 11, 12];", + "var ourTotal = 0;", + "", + "for (var i = 0; i < ourArr.length; i++) {", + " ourTotal += ourArr[i];", + "}", + "", + "// Setup", + "var myArr = [ 2, 3, 4, 5, 6];", + "", + "// Only change code below this line", + "", + "" + ], + "tail": [ + "(function(t) { if(typeof t !== 'undefined') { return \"Total = \" + t; } else { return \"Total is undefined\";}})(total);" + ], + "solutions": [ + "var myArr = [ 2, 3, 4, 5, 6];", + "var total = 0;", + "", + "for (var i = 0; i < myArr.length; i++) {", + " total += myArr[i];", + "}" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244e1", + "title": "Nesting For Loops", + "description": [ + "If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:", + "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; k < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", + "This outputs each sub-element in arr one at a time. Note that for the inner loop we are checking the .length of arr[i], since arr[i] is itself an array." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ "", "", "" ], "tail": [ - "if(typeof myArray !== \"undefined\"){(function(){return myArray;})();}" + "" + ], + "solutions": [ + "" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Cuenta hacia atrás con un ciclo for", - "descriptionEs": [ - "Un ciclo también puede contar hacia atrás, siempre y cuando definamos las condiciones adecuadas.", - "Para contar hacia atrás de dos en dos, tendremos que cambiar nuestra inicialización, la condición y la última-expresión.", - "Vamos a empezar con i = 10 e iteraremos mientras i > 0. Vamos a decrementar i de a 2 por cada iteración con i -= 2. ", - "var ourArray = [];", - "for (var i = 10; i > 0; i -= 2) {", - "  ourArray.push(i);", - "}", - "ourArray ahora contendrá [10,8,6,4,2].", - "Vamos a cambiar nuestra inicialización y la expresión final para que podamos contar hacia atrás de dos en dos pero números impares.", - "Empuja los números impares del 9 a 1 en myArray utilizando un ciclo for." - ] + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "cf1111c1c11feddfaeb1bdef", @@ -1248,7 +4094,7 @@ "Another type of JavaScript loop is called a \"while loop\", because it runs \"while\" something is true and stops once that something is no longer true.", "var ourArray = [];", "var i = 0;", - "while (i < 5) {", + "while(i < 5) {", "  ourArray.push(i);", "  i++;", "}", @@ -1268,36 +4114,49 @@ "", "// Only change code above this line.", "", - "if(typeof myArray !== \"undefined\"){(function(){return myArray;})();}", + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}", "" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Iterar con JavaScript con ciclos while", - "descriptionEs": [ - "Puede ejecutar el mismo código varias veces mediante el uso de un ciclo.", - "Otro tipo de ciclo de JavaScript se llama un ciclo \"while\", ya que se ejecuta, \"mientras que\" algo sea cierto y se detiene una vez que ya no sea así.", - "var ourArray = [];", - "var i = 0;", - "while(i < 5) {", - "  ourArray.push(i);", - "  i++;", - "}", - "Intentemos que un ciclo while empuje valores en un vector.", - "Empuja los números de 0 a 4 para myArray utilizando un ciclo while." - ] + "challengeType": "1" + }, + { + "id": "56533eb9ac21ba0edf2244e2", + "title": "Checkpoint: Conditionals and Loops", + "description": [ + "" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" }, { "id": "cf1111c1c11feddfaeb9bdef", "title": "Generate Random Fractions with JavaScript", "description": [ "Random numbers are useful for creating random behavior.", - "JavaScript has a Math.random() function that generates a random decimal number between 0 and 1.", + "JavaScript has a Math.random() function that generates a random decimal number.", "Change myFunction to return a random number instead of returning 0.", "Note that you can return a function, just like you would return a variable or value." ], "tests": [ - "assert(typeof myFunction() === \"number\", 'message: myFunction should return a random number.');", + "assert(typeof(myFunction()) === \"number\", 'message: myFunction should return a random number.');", "assert((myFunction()+''). match(/\\./g), 'message: The number returned by myFunction should be a decimal.');", "assert(editor.getValue().match(/Math\\.random/g).length >= 0, 'message: You should be using Math.random to generate the random decimal number.');" ], @@ -1314,14 +4173,7 @@ "(function(){return myFunction();})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Generar fracciones al azar con JavaScript", - "descriptionEs": [ - "Los números aleatorios son útiles para crear un comportamiento aleatorio.", - "JavaScript tiene una función Math.random() que genera un número decimal aleatorio.", - "Cambia myFunction para que devuelva un número al azar en lugar de devolver 0.", - "Ten en cuenta que puedes retornar lo retornado por una función, igual que harías para devolver una variable o valor." - ] + "challengeType": "1" }, { "id": "cf1111c1c12feddfaeb1bdef", @@ -1339,8 +4191,7 @@ "Let's use this technique to generate and return a random whole number between 0 and 9." ], "tests": [ - "assert(editor.getValue().match(/var\\srandomNumberBetween0and19\\s=\\sMath.floor\\(Math.random\\(\\)\\s\\*\\s20\\);/).length == 1, 'message: The first line of code should not be changed.');", - "assert(typeof myFunction() === \"number\" && (function(){var r = myFunction();return Math.floor(r) === r;})(), 'message: The result of myFunction should be a whole number.');", + "assert(typeof(myFunction()) === \"number\" && (function(){var r = myFunction();return Math.floor(r) === r;})(), 'message: The result of myFunction should be a whole number.');", "assert(editor.getValue().match(/Math.random/g).length > 1, 'message: You should be using Math.random to generate 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), 'message: You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine.');", "assert(editor.getValue().match(/Math.floor/g).length > 1, 'message: You should use Math.floor to remove the decimal part of the number.');" @@ -1361,20 +4212,7 @@ "(function(){return myFunction();})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Genera números aleatorios enteros con JavaScript", - "descriptionEs": [ - "Es muy bueno que podamos generar números decimales al azar, pero es aún más útil si lo utilizamos para generar números enteros aleatorios.", - "En primer lugar, vamos a usar Math.random() para generar un decimal aleatorio.", - "Entonces vamos a multiplicar este decimal azar por 20.", - "Por último, vamos a usar otra función, Math.floor() para redondear el número hasta su número entero más próximo.", - "Esta técnica nos da un número entero entre 0 y 19.", - "Tenga en cuenta que debido a que estamos redondeando, es imposible obtener 20.", - "Poniendo todo junto, así es como se ve nuestro código:", - "Math.floor(Math.random() * 20);", - "¿Ves como Math.floor toma (Math.random() * 20) como su argumento? Así es - puedes pasar el resultado de un función como argumento de otra función.", - "usemos esta técnica para generar y devolver un número entero aleatorio entre 0 y 9." - ] + "challengeType": "1" }, { "id": "cf1111c1c12feddfaeb2bdef", @@ -1422,70 +4260,7 @@ "(function(){return myFunction();})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Genera números aleatorios enteros dentro de un rango", - "descriptionEs": [ - "En lugar de generar un número aleatorio entre cero y un número dado como lo hicimos antes, podemos generar un número aleatorio que caiga dentro de un rango de dos números específicos.", - "Para ello, vamos a definir un número mínimo min y un número máximo max.", - "He aquí la fórmula que utilizaremos. Tómate un momento para leer y tratar de entender lo que el código está haciendo: ", - "Math.floor(Math.random() * (max - min + 1)) + min", - "Definir dos variables: myMin y myMax, y asignales valores enteros.", - "A continuación, crea una función llamada myFunction que devuelva un número aleatorio mayor o igual a myMin, y menor o igual a myMax. " - ] - }, - { - "id": "cf1111c1c12feddfaeb3bdef", - "title": "Use Conditional Logic with If and Else Statements", - "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.", - "For example:", - "var x = 1;", - "if (x === 2) {", - "  return 'x is 2';", - "} else {", - "  return 'x is not 2';", - "}", - "Let's use if and else statements to make a coin-flip game.", - "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(editor.getValue().match(/if/g).length >= 2, 'message: Create a new if statement.');", - "assert(editor.getValue().match(/else/g).length >= 1, 'message: Created a new else statement.');", - "assert((function(){var result = myFunction();if(result === 'heads' || result === 'tails'){return true;} else {return false;}})(), 'message: myFunction should either return heads or tails.');", - "assert((function(){flip = 0; var result = myFunction(); if(result === 'heads'){return true;} else {return false;}})(), 'message: myFunction should return heads when flip equals 0');", - "assert((function(){flip = 1; var result = myFunction(); if(result === 'tails'){return true;} else {return false;}})(), 'message: myFunction should return tails when flip equals 1');" - ], - "challengeSeed": [ - "var flip = Math.floor(Math.random() * 2);", - "", - "function myFunction() {", - "", - " // Only change code below this line.", - "", - "", - "", - " // Only change code above this line.", - "", - "}", - "", - "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, - "nameEs": "Usa lógica condicional con instrucciones if y else", - "descriptionEs": [ - "Podemos usar instrucciones if (\"if\" es \"si\" en español) en JavaScript para ejecutar código sólo cuando cierta condición se cumpla.", - "Las instrucciones if requieren evaluar algún tipo de condición booleana.", - "Por ejemplo:", - "if (1 === 2) {", - "  return true;", - "} else {", - "  return false;", - "}", - "Vamos a usar la instrucción if con else (\"else\" puede traducirse como \"de lo contrario\") para hacer un juego de cara o sello.", - "Crea una instrucción if con else que retorne la cadena \"heads\" si la variable flip es cero, o bien que retorne \"tails\" si la variable flip no es cero. " - ] + "challengeType": "1" }, { "id": "cf1111c1c12feddfaeb6bdef", @@ -1502,11 +4277,11 @@ "We can do this by replacing the . part of our regular expression with the word and." ], "tests": [ - "assert(myTest==2, 'message: Your regular expression should find two occurrences of the word and.');", + "assert(test==2, 'message: Your regular expression should find two occurrences of the word and.');", "assert(editor.getValue().match(/\\/and\\/gi/), 'message: Use regular expressions to find the word and in testString.');" ], "challengeSeed": [ - "var myTest = (function() {", + "var test = (function() {", " var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";", " var expressionToGetSoftware = /software/gi;", "", @@ -1517,22 +4292,10 @@ " // Only change code above this line.", "", " return testString.match(expression).length;", - "})();(function(){return myTest;})();" + "})();(function(){return test;})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Examina un texto con expresiones regulares", - "descriptionEs": [ - "Las expresiones regulares se utilizan para encontrar ciertas palabras o patrones dentro de cadenas.", - "Por ejemplo, si quisiéramos encontrar la palabra el en la cadena El perro persiguió al gato el lunes, podríamos utilizar la siguiente expresión regular: /el/gi ", - "Vamos a dividirla un poco:", - "el es el patrón con el que queremos coincidir.", - "g significa que queremos buscar el patrón en toda la cadena y no sólo la primera ocurrencia.", - "i significa que queremos ignorar la capitalización (en mayúsculas o minúsculas) cuando se busque el patrón.", - "Las expresiones regulares se escriben rodeando el patrón con símbolos de barra /.", - "Vamos a tratar de seleccionar todas las apariciones de la palabra and en la cadena Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.", - "Podemos hacer esto sustituyendo la parte . de nuestra expresión regular por la palabra and." - ] + "challengeType": "1" }, { "id": "cf1111c1c12feddfaeb7bdef", @@ -1546,10 +4309,10 @@ ], "tests": [ "assert(editor.getValue().match(/\\/\\\\d\\+\\//g), 'message: Use the /\\d+/g regular expression to find the numbers in testString.');", - "assert(myTest === 2, 'message: Your regular expression should find two numbers in testString.');" + "assert(test === 2, 'message: Your regular expression should find two numbers in testString.');" ], "challengeSeed": [ - "var myTest = (function() {", + "var test = (function() {", "", " var testString = \"There are 3 cats but 4 dogs.\";", "", @@ -1561,18 +4324,10 @@ "", " return testString.match(expression).length;", "", - "})();(function(){return myTest;})();" + "})();(function(){return test;})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Encuentra números con expresiones regulares", - "descriptionEs": [ - "Podemos usar selectores especiales en las expresiones regulares para seleccionar un determinado tipo de valor.", - "Uno de estos selectores es el de dígitos \\d que se utiliza para hacer coincidir números en una cadena.", - "Se usa así para hacer coincidir un dígito: /\\d/g.", - "Para hacer coincidir números de varios dígtios a menudo se escribe /\\d+/ g , donde el + que sigue al selector de dígito le permite a la expresión regular coincidir con uno o más dígito es decir coincide con números de varios dígitos.", - "Usa el selector \\d para hacer coincidir todos los números de la cadena, permitiendo la posibilidad de hacer coincidir números de varios dígitos." - ] + "challengeType": "1" }, { "id": "cf1111c1c12feddfaeb8bdef", @@ -1586,10 +4341,10 @@ ], "tests": [ "assert(editor.getValue().match(/\\/\\\\s\\+\\//g), 'message: Use the /\\s+/g regular expression to find the spaces in testString.');", - "assert(myTest === 7, 'message: Your regular expression should find seven spaces in testString.');" + "assert(test === 7, 'message: Your regular expression should find seven spaces in testString.');" ], "challengeSeed": [ - "var myTest = (function(){", + "var test = (function(){", " var testString = \"How many spaces are there in this sentence?\";", "", " // Only change code below this line.", @@ -1600,18 +4355,10 @@ "", " return testString.match(expression).length;", "", - "})();(function(){return myTest;})();" + "})();(function(){return test;})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Encuentra espacios en blanco con las expresiones regulares", - "descriptionEs": [ - "También podemos utilizar selectores de expresiones regulares como \\s para encontrar un espacio en blanco en una cadena.", - "Los espacios en blanco son \" \" (espacio), \\r (el retorno de carro), \\n (nueva línea), \\t (tabulador), y \\f (el avance de página). ", - "Una expresión regular con el selector de espacios en blanco puede ser:", - "/\\s+/g", - "Se usa para hacer coincidir todos los espacios en blanco en una cadena." - ] + "challengeType": "1" }, { "id": "cf1111c1c13feddfaeb3bdef", @@ -1623,10 +4370,10 @@ ], "tests": [ "assert(editor.getValue().match(/\\/\\\\S\\/g/g), 'message: Use the /\\S/g regular expression to find non-space characters in testString.');", - "assert(myTest === 49, 'message: Your regular expression should find forty nine non-space characters in the testString.');" + "assert(test === 49, 'message: Your regular expression should find forty nine non-space characters in the testString.');" ], "challengeSeed": [ - "var myTest = (function(){", + "var test = (function(){", " var testString = \"How many non-space characters are there in this sentence?\";", "", " // Only change code below this line.", @@ -1636,21 +4383,15 @@ " // Only change code above this line.", "", " return testString.match(expression).length;", - "})();(function(){return myTest;})();" + "})();(function(){return test;})();" ], "type": "waypoint", - "challengeType": 1, - "nameEs": "Hacer coincidir con una expresión regular invertida", - "descriptionEs": [ - "Puedes invertir las coincidencias de un selector usando su versión en mayúsculas.", - "Por ejemplo, \\s coincidirá con cualquier espacio en blanco, mientras que \\S coincidirá con todo lo que no sea espacio en blanco.", - "Usa /\\S/g para contar el número de caracteres que no están en blanco en testString." - ] + "challengeType": "1" }, { "id": "cf1111c1c12feddfaeb9bdef", "title": "Create a JavaScript Slot Machine", - "isBeta": true, + "isBeta": "true", "description": [ "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.", @@ -1659,10 +4400,10 @@ "Math.floor(Math.random() * (3 - 1 + 1)) + 1;" ], "tests": [ - "assert(typeof runSlots($(\".slot\"))[0] === \"number\" && runSlots($(\".slot\"))[0] > 0 && runSlots($(\".slot\"))[0] < 4, 'message: slotOne should be a random number.');", - "assert(typeof runSlots($(\".slot\"))[1] === \"number\" && runSlots($(\".slot\"))[1] > 0 && runSlots($(\".slot\"))[1] < 4, 'message: slotTwo should be a random number.');", - "assert(typeof runSlots($(\".slot\"))[2] === \"number\" && runSlots($(\".slot\"))[2] > 0 && runSlots($(\".slot\"))[2] < 4, 'message: slotThree should be a random number.');", - "assert((function(){if(code.match(/Math\\.floor\\(\\s?Math\\.random\\(\\)\\s?\\*\\s?\\(\\s?3\\s?\\-\\s?1\\s?\\+\\s?1\\s?\\)\\s?\\)\\s?\\+\\s?1/gi) !== null){return code.match(/slot.*?=.*?\\(.*?\\).*?/gi).length >= 3;}else{return false;}})(), 'message: You should have used Math.floor(Math.random() * (3 - 1 + 1)) + 1; three times to generate your random numbers.');" + "assert(typeof(runSlots($(\".slot\"))[0]) === \"number\" && runSlots($(\".slot\"))[0] > 0 && runSlots($(\".slot\"))[0] < 4, 'slotOne should be a random number.')", + "assert(typeof(runSlots($(\".slot\"))[1]) === \"number\" && runSlots($(\".slot\"))[1] > 0 && runSlots($(\".slot\"))[1] < 4, 'slotTwo should be a random number.')", + "assert(typeof(runSlots($(\".slot\"))[2]) === \"number\" && runSlots($(\".slot\"))[2] > 0 && runSlots($(\".slot\"))[2] < 4, '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(/slot.*?=.*?\\(.*?\\).*?/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", @@ -1800,20 +4541,12 @@ "" ], "type": "waypoint", - "challengeType": 0, - "nameEs": "Crea una máquina tragamonedas en JavaScript", - "descriptionEs": [ - "Ahora vamos a tratar de combinar algunas de las cosas que hemos aprendido para crear la lógica de una máquina tragamonedas.", - "Para esto tendremos que generar tres números aleatorios entre 1 y 3 que representen los valores posibles de cada casilla.", - "Guarda los tres números aleatorios en slotOne, slotTwo y slotThree.", - "Genera los números aleatorios utilizando el sistema que usamos anteriormente (puedes encontrar una explicación de la fórmula aquí):", - "Math.floor(Math.random() * (3 - 1 + 1)) + 1;" - ] + "challengeType": "0" }, { "id": "cf1111c1c13feddfaeb1bdef", "title": "Add your JavaScript Slot Machine Slots", - "isBeta": true, + "isBeta": "true", "description": [ "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 and we should return null.", @@ -1826,7 +4559,7 @@ "If all three numbers match, we should also set the text \"It's A Win\" to the element with class logger." ], "tests": [ - "assert((function(){var data = runSlots();return data === null || data.toString().length === 1;})(), 'message: 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();return data === null || data.toString().length === 1;})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.')" ], "challengeSeed": [ "fccss", @@ -1968,24 +4701,12 @@ "" ], "type": "waypoint", - "challengeType": 0, - "nameEs": "Añade casillas a tu tragamonedas JavaScript", - "descriptionEs": [ - "Ahora que cada una de nuestras casillas genera números aleatorios, tenemos que comprobar si todos quedan con el mismo número.", - "Si es así, debemos notificar a nuestros usuarios que han ganado y debemos retornar null.", - "null es una estructura de datos de JavaScript que significa \"nada\".", - "El usuario gana cuando los tres números coinciden. Cremos una instrucción if con varias condiciones, a fin de comprobar si todos los números son iguales. ", - "if(slotOne === slotTwo && slotTwo === slotThree){", - "  return null;", - "}", - "Además, tenemos que mostrar al usuario que ha ganado la partida e caso de que esté el mismo número en todas las casillas.", - "Si los tres números coinciden, también hay que poner el texto \"It's A Win\" en el elemento HTML con clase logger." - ] + "challengeType": "0" }, { "id": "cf1111c1c13feddfaeb2bdef", "title": "Bring your JavaScript Slot Machine to Life", - "isBeta": true, + "isBeta": "true", "description": [ "Now we can detect a win. Let's get this slot machine working.", "Let's use the jQuery selector $(\".slot\") to select all of the slots.", @@ -1995,8 +4716,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;}})(), 'message: You should be displaying the result of the slot numbers in the corresponding slots.');", - "assert((code.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi) && code.match( /\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)/gi ).length >= 3 && code.match( /\\.html\\(slotOne\\)/gi ) && code.match( /\\.html\\(slotTwo\\)/gi ) && code.match( /\\.html\\(slotThree\\)/gi )), 'message: 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", @@ -2146,21 +4867,12 @@ "" ], "type": "waypoint", - "challengeType": 0, - "nameEs": "Da vida a tu máquina tragamonedas en JavaScript", - "descriptionEs": [ - "Ahora podemos detectar una victoria. Logremos que la máquina tragamonedas funcione. ", - "Usemos un selector de jQuery $(\".slot\") para seleccionar todas las casillas.", - "Una vez que todas estén seleccionados, podemos usar notación de corchetes para acceder a cada casilla individual:", - "$($(\".slot\")[0]).html(slotOne);", - "Este jQuery seleccionará la primera ranura y actualizará su HTML para mostrar el número correcto.", - "Usa el selector anterior para mostrar cada número en su casilla correspondiente." - ] + "challengeType": "0" }, { "id": "cf1111c1c11feddfaeb1bdff", "title": "Give your JavaScript Slot Machine some Stylish Images", - "isBeta": true, + "isBeta": "true", "description": [ "Now let's add some images to our slots.", "We've already set up the images for you in an array called images. We can use different indexes to grab each of these.", @@ -2169,13 +4881,13 @@ "Set up all three slots like this, then click the \"Go\" button to play the slot machine." ], "tests": [ - "assert((code.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\\\'\\s*?\\);/gi) && code.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[\\d\\]\\s*?\\)\\.html\\(\\s*?\\'\\\\'\\s*?\\);/gi).length >= 3), 'message: Use the provided code three times. One for each slot.');", - "assert(code.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[0\\]\\s*?\\)/gi), 'message: You should have used $('.slot')[0] at least once.');", - "assert(code.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[1\\]\\s*?\\)/gi), 'message: You should have used $('.slot')[1] at least once.');", - "assert(code.match(/\\$\\s*?\\(\\s*?\\$\\s*?\\(\\s*?(?:'|\")\\s*?\\.slot\\s*?(?:'|\")\\s*?\\)\\[2\\]\\s*?\\)/gi), 'message: You should have used $('.slot')[2] at least once.');", - "assert(code.match(/slotOne/gi) && code.match(/slotOne/gi).length >= 7, 'message: You should have used the slotOne value at least once.');", - "assert(code.match(/slotTwo/gi) && code.match(/slotTwo/gi).length >= 8, 'message: You should have used the slotTwo value at least once.');", - "assert(code.match(/slotThree/gi) && code.match(/slotThree/gi).length >= 7, 'message: 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", @@ -2329,15 +5041,7 @@ "" ], "type": "waypoint", - "challengeType": 0, - "nameEs": "Dale a tu máquina tragamonedas JavaScript algunas imágenes con estilo", - "descriptionEs": [ - "Ahora añadamos algunas imágenes en nuestras casillas.", - "Ya hemos creado las imágenes por ti en una matriz llamada images. Podemos utilizar diferentes índices para tomara cada una de estas. ", - "Aquí está como haríamos que la primera casilla muestre una imagen diferente dependiendo del número aleatorio que se genere:", - "$($('.slot')[0]).html('<img src = \"' + images[slotOne-1] + '\">');", - "Configura las tres casillas de manera análoga, a continuación, pulsa el botón \"Go\" para jugar con la máquina tragamonedas." - ] + "challengeType": "0" } ] -} +} \ No newline at end of file From 8991dd7e6daf1926ce844e6434155778cbcbde28 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 21 Dec 2015 13:50:45 -0800 Subject: [PATCH 011/174] More Challenges --- .../basic-javascript.json | 116 ++++++++++++++---- 1 file changed, 91 insertions(+), 25 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 4818cf354a..95c59ccac2 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1709,17 +1709,16 @@ "description": [ "In JavaScript, we can divide up our code into reusable parts called functions.", "Here's an example of a function:", - "function functionName() {", - "  console.log(\"Hello World\");", - "}", - "You can call or invoke this function by using its name followed by parenthese, like this:", + "
function functionName() {
console.log(\"Hello World\");
}
", + "You can call or invoke this function by using its name followed by parentheses, like this:", "functionName();", "Each time the function is called it will print out the message \"Hello World\" on the dev console. All of the code between the curly braces will be executed every time the function is called.", "

Instructions

Create a function called myFunction which prints \"Hi World\" to the dev console. Call that function." ], "tests": [ - "console.log(\"1 '\" + logOutput + \"'\", \"op: \" + /Hi World/.test(logOutput)); assert(\"Hi World\" === logOutput, 'message: myFunction should output \"Hi World\"');", - "assert(typeof myFunction === 'function', 'message: myFunction should be a function');" + "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", + "assert(\"Hi World\" === logOutput, 'message: myFunction should output \"Hi World\" to the dev console');", + "assert(/^\\s*myFunction\\(\\)\\s*;/m.test(editor.getValue()), 'message: Call myFunction after you define it');" ], "challengeSeed": [ "// Example", @@ -1727,6 +1726,8 @@ " console.log(\"Heyya, World\");", "}", "", + "ourFunction();", + "", "// Only change code below this line", "", "" @@ -1757,7 +1758,8 @@ "solutions": [ "function myFunction() {", " console.log(\"Hi World\");", - "}" + "}", + "myFunction();" ], "type": "waypoint", "challengeType": "1" @@ -1767,17 +1769,34 @@ "title": "Passing Values to Functions with Arguments", "description": [ "Functions can take input in the form of parameters. Parameters are variables that take on the value of the arguments which are passed in to the function. Here is a function with two parameters, param1 and param2:", - "function testFunct(param1, param2) {", - "  console.log(param1, param2);", - "}", - "Then we can call testFunction:", - "testFunction(\"Hello\", \"World\");", - "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFunction again with different arguments and the parameters would take on the value of the new arguments.", - "

Instructions

Create a function called myFunction that accepts two arguements and outputs their sum to console.log" + "
function testFun(param1, param2) {
console.log(param1, param2);
}
", + "Then we can call testFun:", + "testFun(\"Hello\", \"World\");", + "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFun again with different arguments and the parameters would take on the value of the new arguments.", + "

Instructions

Create a function called myFunction that accepts two arguments and outputs their sum to the dev console. Call your function." ], "releasedOn": "11/27/2015", "tests": [ - "assert((function(){if(typeof(f) !== \"undefined\" && f === a + b){return true;}else{return false;}})(), 'message: Your function should ouput the value of a + b.');" + "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", + "capture(); myFunction(1,2); uncapture(); assert(logOutput == 3, 'message: myFunction(1,2) should output 3');", + "capture(); myFunction(7,9); uncapture(); assert(logOutput == 16, 'message: myFunction(7,9) should output 16');", + "assert(/^\\s*myFunction\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\)\\s*;/m.test(editor.getValue()), 'message: Call myFunction after you define it');" + ], + "head": [ + "var logOutput = \"\";", + "var oldLog = console.log;", + "function capture() {", + " console.log = function (message) {", + " logOutput = message + ''.trim();", + " oldLog.apply(console, arguments);", + " };", + "}", + "", + "function uncapture() {", + " console.log = oldLog;", + "}", + "", + "capture();" ], "challengeSeed": [ "// Example", @@ -1788,11 +1807,16 @@ "", "// Only change code below this line.", "", - "", "" ], "tail": [ - "" + "uncapture();", + "", + "if (typeof myFunction !== \"function\") { ", + " (function() { return \"myFunction is not defined\"; })();", + "} else {", + " (function() { return logOutput || \"console.log never called\"; })();", + "}" ], "solutions": [ "" @@ -1809,19 +1833,60 @@ "id": "56533eb9ac21ba0edf2244be", "title": "Global Scope and Functions", "description": [ - "In Javascript, scope refers to the visibility of variables." + "In Javascript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means the can be seen everywhere in your Javascript code. ", + "Variables which are used without the var keyword are automatically created in the global scope. This can create unintended concequences elsewhere in your code or when running a function again. You should always declare your variables with var.", + "

Instructions

Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10 ", + "Inside function fun1, assign 5 to oopsGlobal without using the var keyword." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert(typeof myGlobal != \"undefined\", 'message: myGlobal should be defined');", + "assert(myGlobal === 10, 'message: myGlobal should have a value of 10');", + "assert(/var\\s+myGlobal/.test(editor.getValue()), 'message: myGlobal should be declared using the var keyword');", + "assert(typeof oopsGlobal != \"undefined\" && oopsGlobal === 5, 'message: oopsGlobal should have a value of 5');", + "assert(!/var\\s+oopsGlobal/.test(editor.getValue()), 'message: Do not decalre oopsGlobal using the var keyword');" + ], + "head": [ + "var logOutput = \"\";", + "var oldLog = console.log;", + "function capture() {", + " console.log = function (message) {", + " logOutput = message;", + " oldLog.apply(console, arguments);", + " };", + "}", + "", + "function uncapture() {", + " console.log = oldLog;", + "}", + "", + "capture();" ], "challengeSeed": [ + "// Declare your variable here", "", "", - "" + "function fun1() {", + " // Assign 5 to oopsGlobal Here", + "}", + "", + "// Only change code above this line", + "function fun2() {", + " var output = \"\";", + " if(typeof myGlobal != \"undefined\") {", + " output += \"myGlobal: \" + myGlobal;", + " }", + " if(typeof oopsGlobal != \"undefined\") {", + " output += \" oopsGlobal: \" + oopsGlobal;", + " }", + " console.log(output);", + "}" ], "tail": [ - "" + "fun1();", + "fun2();", + "uncapture();", + "(function() { return logOutput || \"console.log never called\"; })();" ], "solutions": [ "" @@ -1838,10 +1903,11 @@ "id": "56533eb9ac21ba0edf2244bf", "title": "Local Scope and Functions", "description": [ - "In Javascript, Scope is the test of variables, object, and functions you have access to. Variables which are defined within a function and parameters are local, which means they are only visible within that function. ", - "Here is a function test with a local variable called loc.", - "
function test() {
var loc = \"foo\";
console.log(local1); // \"foo\"
}
test();
console.log(loc); // \"undefined\"
", - "loc is not defined outside of the function." + "Variables which are declared within a function, as well as function parameters are local. Thos means they are only visible within that function. ", + "Here is a function myTest with a local variable called loc.", + "
function myTest() {
var local1 = \"foo\";
console.log(local1);
}
myTest(); // \"foo\"
console.log(local1); // \"undefined\"
", + "local1 is not defined outside of the function.", + "

Instructions

Declare a local variable myVar inside myFunction" ], "releasedOn": "11/27/2015", "tests": [ From ff4f013de7dce669e9d86b083060430b76f5e6fa Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 22 Dec 2015 00:59:26 -0800 Subject: [PATCH 012/174] More Challenges --- .../basic-javascript.json | 51 +++++++++++++------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 95c59ccac2..2763f16f4e 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1914,8 +1914,12 @@ "assert(1===1, 'message: message here');" ], "challengeSeed": [ + "function myFunction() {", + " ", + " console.log(myVar);", + "}", "", - "", + "console.log(myVar);", "" ], "tail": [ @@ -4127,21 +4131,44 @@ "description": [ "If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:", "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; k < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", - "This outputs each sub-element in arr one at a time. Note that for the inner loop we are checking the .length of arr[i], since arr[i] is itself an array." + "This outputs each sub-element in arr one at a time. Note that for the inner loop we are checking the .length of arr[i], since arr[i] is itself an array.", + "

Instructions

The function multiplyAll will be passed a multi-dimensional array, arr. Loop through both levels of arr and multiply product by each one." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert(multiplyAll([[1],[2],[3]]) === 6, 'message: multiplyAll([[1],[2],[3]]); should return 6');", + "assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, 'message: multiplyAll([[1,2],[3,4],[5,6,7]]) should return 5040');", + "assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, 'message: multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]);) should return 54');" ], "challengeSeed": [ + "function multiplyAll(arr) {", + " var product = 1;", + " // Only change code below this line", "", + " // Only change code above this line", + " return product;", + "}", "", + "// Modify values below to test your code", + "multiplyAll([[1,2],[3,4],[5,6,7]]);", "" ], "tail": [ "" ], "solutions": [ + "function multiplyAll(arr) {", + " var product = 1;", + " for (var i = 0; i < arr.length; i++) {", + " for (var j = 0; j < arr[i].length; j++) {", + " product *= arr[i][j];", + " }", + " }", + " return product;", + "}", + "", + "multiplyAll([[1,2],[3,4],[5,6,7]]);", + "", "" ], "type": "waypoint", @@ -4158,31 +4185,25 @@ "description": [ "You can run the same code multiple times by using a loop.", "Another type of JavaScript loop is called a \"while loop\", because it runs \"while\" something is true and stops once that something is no longer true.", - "var ourArray = [];", - "var i = 0;", - "while(i < 5) {", - "  ourArray.push(i);", - "  i++;", - "}", + "
var ourArray = [];
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
", "Let's try getting a while loop to work by pushing values to an array.", - "Push the numbers 0 through 4 to myArray using a while loop." + "

Instructions

Push the numbers 0 through 4 to myArray using a while loop." ], "tests": [ "assert(editor.getValue().match(/while/g), 'message: You should be using a while loop for this.');", "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray should equal [0,1,2,3,4].');" ], "challengeSeed": [ + "// Setup", "var myArray = [];", "", "// Only change code below this line.", "", - "", - "", - "// Only change code above this line.", - "", - "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}", "" ], + "tail": [ + "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" + ], "type": "waypoint", "challengeType": "1" }, From ec01155c0d28be82801051cfc4b7ddc217ae2c4d Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 22 Dec 2015 13:27:17 -0800 Subject: [PATCH 013/174] Change display for blockquote and h4 lines --- client/less/challenge.less | 3 +- .../basic-javascript.json | 246 ++++++++++++------ server/views/coursewares/showBonfire.jade | 5 +- server/views/coursewares/showJS.jade | 5 +- 4 files changed, 175 insertions(+), 84 deletions(-) diff --git a/client/less/challenge.less b/client/less/challenge.less index 06f40ee4b3..2a863e5a8b 100644 --- a/client/less/challenge.less +++ b/client/less/challenge.less @@ -11,7 +11,8 @@ border: 1px solid @pre-border-color; white-space: pre; padding: 5px 10px; - margin-bottom: 5px; + margin-bottom: 10px; + margin-top: -10px; overflow: auto; } diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 2763f16f4e..305ea24fd4 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -13,7 +13,8 @@ "// This is a comment.", "The slash-star-star-slash comment will comment out everything between the /* and the */ characters:", "/* This is also a comment */", - "

Instructions

Try creating one of each type of comment." + "

Instructions

", + "Try creating one of each type of comment." ], "tests": [ "assert(editor.getValue().match(/(\\/\\/)...../g), 'message: Create a // style comment that contains at least five letters.');", @@ -29,7 +30,8 @@ "description": [ "In computer science, data structures are things that hold data. JavaScript has seven of these. For example, the Number data structure holds numbers.", "Let's learn about the most basic data structure of all: the Boolean. Booleans can only hold the value of either true or false. They are basically little on-off switches.", - "

Instructions

Modify the welcomeToBooleans function so that it will return true instead of false when the run button is clicked." + "

Instructions

", + "Modify the welcomeToBooleans function so that it will return true instead of false when the run button is clicked." ], "tests": [ "assert(typeof(welcomeToBooleans()) === 'boolean', 'message: The welcomeToBooleans() function should return a boolean (true/false) value.');", @@ -58,7 +60,8 @@ "When we store data in a data structure, we call it a variable. These variables are no different from the x and y variables you use in math.", "Let's create our first variable and call it \"myName\".", "You'll notice that in myName, we didn't use a space, and that the \"N\" is capitalized. JavaScript variables are written in camel case. An example of camel case is: camelCase.", - "

Instructions

Use the var keyword to create a variable called myName. Set its value to your name, in double quotes.", + "

Instructions

", + "Use the var keyword to create a variable called myName. Set its value to your name, in double quotes.", "Hint", "Look at the ourName example if you get stuck." ], @@ -89,7 +92,8 @@ "myVar = 5;", "myNum = myVar;", "Assigns 5 to myVar and then resolves myVar to 5 again and assigns it to myNum.", - "

Instructions

Assign the value 7 to variable a", + "

Instructions

", + "Assign the value 7 to variable a", "Assign the contents of a to variable b." ], "releasedOn": "11/27/2015", @@ -133,7 +137,8 @@ "var myVar = 0;", "Creates a new variable called myVar and assigns it an inital value of 0.", "", - "

Instructions

Define a variable a with var and initialize it to a value of 9." + "

Instructions

", + "Define a variable a with var and initialize it to a value of 9." ], "releasedOn": "11/27/2015", "tests": [ @@ -165,7 +170,8 @@ "title": "Understanding Uninitialized Variables", "description": [ "When Javascript variables are declared, they have an inital value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatanate a string with an undefined variable, you will get a literal string of \"undefined\".", - "

Instructions

Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." + "

Instructions

", + "Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." ], "releasedOn": "11/27/2015", "tests": [ @@ -214,7 +220,8 @@ "MYVAR is not the same as MyVar nor myvar. It is possible to have mulitpe distinct variables with the same name but different capitalization. It is strongly reccomended that for sake of clarity you do not use this language feature.", "

Best Practice

Variables in Javascript should use camelCase. In camelCase, variables made of multiple words have the first word in all lowercase and the first letter of each subsequent word capitalized.
", "Examples:
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", - "

Instructions

Correct the variable assignements so their names match their variable declarations above." + "

Instructions

", + "Correct the variable assignements so their names match their variable declarations above." ], "releasedOn": "11/27/2015", "tests": [ @@ -258,7 +265,8 @@ "description": [ "Let's try to add two numbers using JavaScript.", "JavaScript uses the + symbol for addition.", - "

Instructions

Change the 0 so that sum will equal 20." + "

Instructions

", + "Change the 0 so that sum will equal 20." ], "tests": [ "assert(sum === 20, 'message: sum should equal 20');", @@ -280,7 +288,8 @@ "description": [ "We can also subtract one number from another.", "JavaScript uses the - symbol for subtraction.", - "

Instructions

Change the 0 so that difference will equal 12." + "

Instructions

", + "Change the 0 so that difference will equal 12." ], "tests": [ "assert(difference === 12, 'message: Make the variable difference equal 12.');", @@ -306,7 +315,8 @@ "description": [ "We can also multiply one number by another.", "JavaScript uses the * symbol for multiplication.", - "

Instructions

Change the 0 so that product will equal 80." + "

Instructions

", + "Change the 0 so that product will equal 80." ], "tests": [ "assert(product === 80,'message: Make the variable product equal 80');", @@ -332,7 +342,8 @@ "description": [ "We can also divide one number by another.", "JavaScript uses the / symbol for division.", - "

Instructions

Change the 0 so that quotient will equal 2." + "

Instructions

", + "Change the 0 so that quotient will equal 2." ], "tests": [ "assert(quotient === 2, 'message: Make the variable quotient equal 2.');", @@ -357,7 +368,8 @@ "i++;", "is the equivilent of", "i = i + 1;", - "

Instructions

Change the code to use the ++ operator on myVar" + "

Instructions

", + "Change the code to use the ++ operator on myVar" ], "releasedOn": "11/27/2015", "tests": [ @@ -395,7 +407,8 @@ "i--;", "is the equivilent of", "i = i - 1;", - "

Instructions

Change the code to use the -- operator on myVar" + "

Instructions

", + "Change the code to use the -- operator on myVar" ], "releasedOn": "11/27/2015", "tests": [ @@ -506,7 +519,8 @@ "Math.floor(5 / 2) === 2
2 * 2 === 4
5 - 4 === 1
", "Usage", "Modulus can be helpful in creating alternating or cycling values. For example, in a loop an increasing variable myVar % 2 will alternate between 0 and 1 as myVar goes between even and odd numbers respectively.", - "

Instructions

Set remainder equal to the remainder of 11 divided by 3 using the modulus operator." + "

Instructions

", + "Set remainder equal to the remainder of 11 divided by 3 using the modulus operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -545,7 +559,8 @@ "to add 5 to myVar. Since this is such a common pattern, there are operators which do both a mathematical operation and assignement in one step.", "One such operator is the += operator.", "myVar += 5; will add 5 to myVar.", - "

Instructions

Convert the assignements for a, b, and c to use the += operator." + "

Instructions

", + "Convert the assignements for a, b, and c to use the += operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -595,7 +610,8 @@ "myVar = myVar - 5;", "Will subtract 5 from myVar. This can be rewritten as: ", "myVar -= 5;", - "

Instructions

Convert the assignements for a, b, and c to use the -= operator." + "

Instructions

", + "Convert the assignements for a, b, and c to use the -= operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -648,7 +664,8 @@ "myVar = myVar * 5;", "Will multiply myVar by 5. This can be rewritten as: ", "myVar *= 5;", - "

Instructions

Convert the assignements for a, b, and c to use the *= operator." + "

Instructions

", + "Convert the assignements for a, b, and c to use the *= operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -699,7 +716,8 @@ "myVar = myVar / 5;", "Will divide myVar by 5. This can be rewritten as: ", "myVar /= 5;", - "

Instructions

Convert the assignments for a, b, and c to use the /= operator." + "

Instructions

", + "Convert the assignments for a, b, and c to use the /= operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -797,7 +815,8 @@ "title": "Declare String Variables", "description": [ "Previously we have used the code var myName = \"your name\". This is what we call a String variable. It is nothing more than a \"string\" of characters. JavaScript strings are always wrapped in quotes.", - "

Instructions

Create two new string variables: myFirstName and myLastName and assign them the values of your first and last name, respectively." + "

Instructions

", + "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;}})(), 'message: myFirstName should be a string with at least one character in it.');", @@ -829,7 +848,8 @@ "description": [ "When you are defining a string you must start and end with a double or single quote. What happens when you need a literal quote inside of your string?", "In Javascript you can escape a quote inside a string by placing a backslash (\\) in front of the quote. This signals Javascript that the following quote is not the end of the string, but should instead should appear inside the string.", - "

Instruction

Use backslashes to assign the following to myStr:
\"I am a \"double quoted\" string inside \"double quotes\"\"" + "

Instruction

", + "Use backslashes to assign the following to myStr:
\"I am a \"double quoted\" string inside \"double quotes\"\"" ], "releasedOn": "11/27/2015", "tests": [ @@ -859,7 +879,8 @@ "\"This string has \\\"double quotes\\\" in it\"", "The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to write and to read. Instead, use single quotes:", "'This string has \"double quotes\" in it'", - "

Instructions

Change the provided string from double to single quotes and remove the escaping." + "

Instructions

", + "Change the provided string from double to single quotes and remove the escaping." ], "releasedOn": "11/27/2015", "tests": [ @@ -889,7 +910,8 @@ "Quotes are not the only character than can be escaped inside a string. Here is a table of common escape sequences:", "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", "Note that the backslash itself must be escaped in order to display as a backslash.", - "

Instructions

Encode the following sequence, seperated by spaces:
backslash tab tab carriage return new line and assign it to myStr" + "

Instructions

", + "Encode the following sequence, seperated by spaces:
backslash tab tab carriage return new line and assign it to myStr" ], "releasedOn": "11/27/2015", "tests": [ @@ -916,7 +938,8 @@ "title": "Concatanting Strings with the Plus Operator", "description": [ "In Javascript the + operator for strings is called the concatanation operator. You can build strings out of other strings by concatanating them together.", - "

Instructions

Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator.", + "

Instructions

", + "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator.", "" ], "releasedOn": "11/27/2015", @@ -986,7 +1009,8 @@ "title": "Constructing Strings with Variables", "description": [ "Sometimes you will need to build a string, Mad Libs style. By using the concatanation operator (+) you can insert one or more varaibles into a string you're building.", - "

Instructions

Set myName and build myStr with myName between the strings \"My name is \" and \" and I am swell!\"" + "

Instructions

", + "Set myName and build myStr with myName between the strings \"My name is \" and \" and I am swell!\"" ], "releasedOn": "11/27/2015", "tests": [ @@ -1021,7 +1045,8 @@ "title": "Appending Variables to Strings", "description": [ "Just as we can build a string over multiple lines out of string literals, we can also append variables to a string using the plus equals (+=) operator.", - "

Instructions

Set someAdjective and append it to myStr using the += operator." + "

Instructions

", + "Set someAdjective and append it to myStr using the += operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -1063,7 +1088,8 @@ "description": [ "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.", - "

Instructions

Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength." + "

Instructions

", + "Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength." ], "tests": [ "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'message: lastNameLength should be equal to eight.');", @@ -1100,7 +1126,8 @@ "Bracket notation is a way to get a character at a specific index within a string.", "Computers don't start counting at 1 like humans do. They start at 0. This is refered to as Zero-based indexing.", "For example, the character at index 0 in the word \"Charles\" is \"C\". So if var firstName = \"Charles\", you can get the value of the first letter of the string by using firstName[0].", - "

Instructions

Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", + "

Instructions

", + "Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", "Hint
Try looking at the firstLetterOfFirstName variable declaration if you get stuck." ], "tests": [ @@ -1142,7 +1169,8 @@ "var myStr = \"Bob\";
myStr[0] = \"J\";
", "will not change the contents of myStr to \"Job\", because the contents of myStr cannot be altered. Note that this does not mean that myStr cannot be change, just that individual characters cannot be changes. The only way to change myStr would be to overwrite the contents with a new string, like this:", "var myStr = \"Bob\";
myStr = \"Job\";
", - "

Instructions

Correct the assignment to myStr to achieve the desired effect." + "

Instructions

", + "Correct the assignment to myStr to achieve the desired effect." ], "releasedOn": "11/27/2015", "tests": [ @@ -1180,7 +1208,8 @@ "description": [ "You can also use bracket notation to get the character at other positions within a string.", "Remember that computers start counting at 0, so the first character is actually the zeroth character.", - "

Instructions

Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", + "

Instructions

", + "Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", "Hint
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ @@ -1215,7 +1244,8 @@ "description": [ "In order to get the last letter of a string, you can subtract one from the string's length.", "For example, if var firstName = \"Charles\", you can get the value of the last letter of the string by using firstName[firstName.length - 1].", - "

Instructions

Use bracket notation to find the last character in the lastName variable.", + "

Instructions

", + "Use bracket notation to find the last character in the lastName variable.", "Hint
Try looking at the lastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ @@ -1251,7 +1281,8 @@ "description": [ "You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.", "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]", - "

Instructions

Use bracket notation to find the second-to-last character in the lastName string.", + "

Instructions

", + "Use bracket notation to find the second-to-last character in the lastName string.", " Hint
Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ @@ -1336,7 +1367,8 @@ "description": [ "With JavaScript array variables, we can store several pieces of data in one place.", "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\"].", - "

Instructions

Create a new array called myArray that contains both a string and a number (in that order).", + "

Instructions

", + "Create a new array called myArray that contains both a string and a number (in that order).", "Hint
Refer to the example code in the text editor if you get stuck." ], "tests": [ @@ -1366,7 +1398,8 @@ "title": "Nest one Array within Another Array", "description": [ "You can also nest arrays within other arrays, like this: [[\"Bulls\", 23]]. This is also called a Multi-dimensional Array.", - "

Instructions

Create a nested array called myArray." + "

Instructions

", + "Create a nested array called myArray." ], "tests": [ "assert(Array.isArray(myArray) && myArray.some(Array.isArray), 'message: myArray should have at least one array nested within another array.');" @@ -1398,7 +1431,8 @@ "var array = [1,2,3];", "array[0]; //equals 1", "var data = array[1];", - "

Instructions

Create a variable called myData and set it to equal the first value of myArray." + "

Instructions

", + "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;}})(), 'message: The variable myData should equal the first value of myArray.');" @@ -1432,7 +1466,8 @@ "For example:", "var ourArray = [3,2,1];", "ourArray[0] = 1; // equals [1,2,1]", - "

Instructions

Modify the data stored at index 0 of myArray to a value of 3." + "

Instructions

", + "Modify the data stored at index 0 of myArray to a value of 3." ], "tests": [ "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: myArray should now be [3,2,3].');", @@ -1470,7 +1505,8 @@ "arr[0]; // equals [1,2,3]", "arr[1][2]; // equals 6", "arr[3][0][1]; // equals 11", - "

Instructions

Read from myArray using bracket notation so that myData is equal to 8" + "

Instructions

", + "Read from myArray using bracket notation so that myData is equal to 8" ], "tests": [ "assert(myData === 8, 'message: myData should be equal to 8.');", @@ -1502,7 +1538,8 @@ "var arr = [1,2,3];", "arr.push(4);", "// arr is now [1,2,3,4]", - "

Instructions

Push [\"dog\", 3] onto the end of the myArray variable." + "

Instructions

", + "Push [\"dog\", 3] onto the end of the myArray variable." ], "tests": [ "\nassert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" @@ -1537,7 +1574,8 @@ "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 store this \"popped off\" variable by performing pop() within a variable declaration.", "Any type of data structure can be \"popped\" off of an array - numbers, strings, even nested arrays.", - "

Instructions

Use the .pop() function to remove the last item from myArray, assigning the \"popped off\" value to removedFromMyArray." + "

Instructions

", + "Use the .pop() function to remove the last item from myArray, assigning the \"popped off\" value to removedFromMyArray." ], "tests": [ "assert((function(d){if(d[0][0] == 'John' && d[0][1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should only contain [[\"John\", 23]].');", @@ -1572,7 +1610,8 @@ "description": [ "pop() always removes the last element of an array. What if you want to remove the first?", "That's where .shift() comes in. It works just like .pop(), except it removes the first element instead of the last.", - "

Instructions

Use the .shift() function to remove the first item from myArray, assigning the \"shifted off\" value to removedFromMyArray." + "

Instructions

", + "Use the .shift() function to remove the first item from myArray, assigning the \"shifted off\" value to removedFromMyArray." ], "tests": [ "assert((function(d){if(d[0][0] == 'dog' && d[0][1] == 3 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"dog\", 3]].');", @@ -1610,7 +1649,8 @@ "description": [ "Not only can you shift elements off of the beginning of an array, you can also unshift elements onto the beginning of an array.", "unshift() works exactly like push(), but instead of adding the element at the end of the array, unshift() adds the element at the beginning of the array.", - "

Instructions

Add [\"Paul\",35] onto the beginning of the myArray variable using unshift()." + "

Instructions

", + "Add [\"Paul\",35] onto the beginning of the myArray variable using unshift()." ], "tests": [ "assert((function(d){if(typeof(d[0]) === \"object\" && d[0][0].toLowerCase() == 'paul' && d[0][1] == 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), 'message: myArray should now have [[\"Paul\", 35], [\"dog\", 3]]).');" @@ -1713,7 +1753,8 @@ "You can call or invoke this function by using its name followed by parentheses, like this:", "functionName();", "Each time the function is called it will print out the message \"Hello World\" on the dev console. All of the code between the curly braces will be executed every time the function is called.", - "

Instructions

Create a function called myFunction which prints \"Hi World\" to the dev console. Call that function." + "

Instructions

", + "Create a function called myFunction which prints \"Hi World\" to the dev console. Call that function." ], "tests": [ "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", @@ -1773,7 +1814,8 @@ "Then we can call testFun:", "testFun(\"Hello\", \"World\");", "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFun again with different arguments and the parameters would take on the value of the new arguments.", - "

Instructions

Create a function called myFunction that accepts two arguments and outputs their sum to the dev console. Call your function." + "

Instructions

", + "Create a function called myFunction that accepts two arguments and outputs their sum to the dev console. Call your function." ], "releasedOn": "11/27/2015", "tests": [ @@ -1835,7 +1877,8 @@ "description": [ "In Javascript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means the can be seen everywhere in your Javascript code. ", "Variables which are used without the var keyword are automatically created in the global scope. This can create unintended concequences elsewhere in your code or when running a function again. You should always declare your variables with var.", - "

Instructions

Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10 ", + "

Instructions

", + "Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10 ", "Inside function fun1, assign 5 to oopsGlobal without using the var keyword." ], "releasedOn": "11/27/2015", @@ -1907,7 +1950,8 @@ "Here is a function myTest with a local variable called loc.", "
function myTest() {
var local1 = \"foo\";
console.log(local1);
}
myTest(); // \"foo\"
console.log(local1); // \"undefined\"
", "local1 is not defined outside of the function.", - "

Instructions

Declare a local variable myVar inside myFunction" + "

Instructions

", + "Declare a local variable myVar inside myFunction" ], "releasedOn": "11/27/2015", "tests": [ @@ -1940,7 +1984,12 @@ "id": "56533eb9ac21ba0edf2244c0", "title": "Global vs. Local Scope in Functions", "description": [ - "Show how global and local scopes interact" + "It is possible to have both a local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.", + "In this example:", + "
var someVar = \"Hat\";
function myFun() {
var someVar = \"Head\";
return someVar;
}
", + "The function myFun will return \"Head\" because the local version of the variable is present.", + "

Instructions

", + "Add a local variable to myFunction to override the value of " ], "releasedOn": "11/27/2015", "tests": [ @@ -1999,7 +2048,8 @@ "For Example:", "
function plusThree(num) {
return num + 3;
}
var answer = plusThree(5); // 8
", "plusThree takes an argument for num and returns a value equal to num + 3.", - "

Instructions

Create a function timesFive that accepts one argument, multiplies it by 5, and returns the new value." + "

Instructions

", + "Create a function timesFive that accepts one argument, multiplies it by 5, and returns the new value." ], "releasedOn": "11/27/2015", "tests": [ @@ -2168,7 +2218,8 @@ "For example:", "
function test(myVal) {
if (myVal > 10) {
return \"Greater Than\";
}
return \"Not Greater Than\";
}
", "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", - "

Instructions

Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than 5." + "

Instructions

", + "Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than 5." ], "tests": [ "assert(typeof myFunction === \"function\", 'message: myFunction should be a function');", @@ -2222,7 +2273,8 @@ "If myVal is equal to 10, the function will return \"Equal\". If it is not, the function will return \"Not Equal\".", "The equality operator will do it's best to convert values for comparison, for example:", "
1 == 1 // true
\"1\" == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
0 == undefined // false
null == undefined // true
", - "

Instructions

Add the equality operator to the indicated line so the function will return \"Equal\" when val is equivilent to 12" + "

Instructions

", + "Add the equality operator to the indicated line so the function will return \"Equal\" when val is equivilent to 12" ], "releasedOn": "11/27/2015", "tests": [ @@ -2265,7 +2317,8 @@ "description": [ "Strict equality (===) is the counterpart to the equality operator (==). Unlike the equality operator, strict equality tests both the type and value of the compared elements.", "Examples
3 === 3 // true
3 === '3' // false
", - "

Instructions

Change the equality operator to a strict equality on the if statement so the function will return \"Equal\" when val is strictltly equal to 7" + "

Instructions

", + "Change the equality operator to a strict equality on the if statement so the function will return \"Equal\" when val is strictltly equal to 7" ], "releasedOn": "11/27/2015", "tests": [ @@ -2308,7 +2361,8 @@ "description": [ "The inequality operator (!=) is the opposite of the equality operator. It means \"Not Equal\" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert types.", "Examples
1 != 2 // true
1 != \"1\" // false
1 != '1' // false
1 != true // false
0 != false // false
", - "

Instructions

Add the inequality operator != to the if statement so the function will return \"Not Equal\" when val is not equivilent to 99" + "

Instructions

", + "Add the inequality operator != to the if statement so the function will return \"Not Equal\" when val is not equivilent to 99" ], "releasedOn": "11/27/2015", "tests": [ @@ -2353,7 +2407,8 @@ "description": [ "The inequality operator (!==) is the opposite of the strict equality operator. It means \"Strictly Not Equal\" and returns false where strict equality would return true and vice versa. Strict inequality will not convert types.", "Examples
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
", - "

Instructions

Add the strict inequality operator to the if statement so the function will return \"Not Equal\" when val is not strictly equal to 17" + "

Instructions

", + "Add the strict inequality operator to the if statement so the function will return \"Not Equal\" when val is not strictly equal to 17" ], "releasedOn": "11/27/2015", "tests": [ @@ -2402,7 +2457,8 @@ "description": [ "The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. If the number on the left is less than or equal to the number on the right, it returns false. Like the equality operator, greater than converts data types.", "Examples
5 > 3 // true
7 > '3' // true
2 > 3 // false
'1' > 9 // false
", - "

Instructions

Add the greater than operator to the indicated lines so that the return statements make sense." + "

Instructions

", + "Add the greater than operator to the indicated lines so that the return statements make sense." ], "releasedOn": "11/27/2015", "tests": [ @@ -2455,7 +2511,8 @@ "description": [ "The greater than equal to operator (>=) compares the values of two numbers. If the number to the left is greater than or equal the number to the right, it returns true. If the number on the left is less than the number on the right, it returns false. Like the equality operator, greater than equal to converts data types.", "Examples
6 >= 6 // true
7 >= '3' // true
2 >= 3 // false
'7' >= 9 // false
", - "

Instructions

Add the greater than equal to operator to the indicated lines so that the return statements make sense." + "

Instructions

", + "Add the greater than equal to operator to the indicated lines so that the return statements make sense." ], "releasedOn": "11/27/2015", "tests": [ @@ -2501,7 +2558,8 @@ "description": [ "The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. If the number on the left is greater than or equal to the number on the right, it returns false. Like the equality operator, less than converts data types.", "Examples
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
", - "

Instructions

Add the less than operator to the indicated lines so that the return statements make sense." + "

Instructions

", + "Add the less than operator to the indicated lines so that the return statements make sense." ], "releasedOn": "11/27/2015", "tests": [ @@ -2546,7 +2604,8 @@ "description": [ "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equl the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", "Examples
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", - "

Instructions

Add the less than equal to operator to the indicated lines so that the return statements make sense." + "

Instructions

", + "Add the less than equal to operator to the indicated lines so that the return statements make sense." ], "releasedOn": "11/27/2015", "tests": [ @@ -2593,7 +2652,8 @@ "Sometimes you will need to test more than one thing at a time. The logical and operator (&&) returns true if and only if the operands to the left and right of it are true.", "The same effect could be achieved by nesting an if statement inside another if:", "
if (num < 10) {
if (num > 5) {
return \"Yes\";
}
}
return \"No\";
Will only return \"Yes\" if num is between 6 and 9. The same logic can be written as:
if (num < 10 && num > 5) {
return \"Yes\";
}
return \"No\";
", - "

Instructions

Combine the two if statements into one statement which returns \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, return \"No\"." + "

Instructions

", + "Combine the two if statements into one statement which returns \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, return \"No\"." ], "releasedOn": "11/27/2015", "tests": [ @@ -2648,7 +2708,8 @@ "The logical or operator (||) returns true if either ofoperands is true, or false if neither is true.", "The pattern below should look familiar from prior waypoints:", "
if (num > 10) {
return \"No\";
}
if (num < 5) {
return \"No\";
}
return \"Yes\";
Will only return \"Yes\" if num is between 5 and 10. The same logic can be written as:
if (num > 10 || num < 5) {
return \"No\";
}
return \"Yes\";
", - "

Instructions

Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." + "

Instructions

", + "Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." ], "releasedOn": "11/27/2015", "tests": [ @@ -2775,7 +2836,8 @@ "description": [ "When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.", "
if (num > 10) {
return \"Bigger than 10\";
} else {
return \"10 or Less\";
}
", - "

Instructions

Combine the if statements into a single statement." + "

Instructions

", + "Combine the if statements into a single statement." ], "releasedOn": "11/27/2015", "tests": [ @@ -2887,7 +2949,8 @@ "description": [ "if...else if statements can be chained together for complex logic. Here is pseudocode of multiple chained if/else if statements:", "
if(condition1) {
statement1
} else if (condition1) {
statement1
} else if (condition3) {
statement3
. . .
} else {
statementN
}
", - "

Instructions

Write chained if/else if statements to fulfill the following conditions:", + "

Instructions

", + "Write chained if/else if statements to fulfill the following conditions:", "num < 5 - return \"Tiny\"
num < 10 - return \"Small\"
num < 15 - return \"Medium\"
num < 20 - return \"Large\"
num >= 20 - return \"Huge\"" ], "releasedOn": "11/27/2015", @@ -2948,7 +3011,8 @@ "If you have many options to choose from use a switch statement A switch statement tests a value and has many case statements which define that value can be, shown here in pseudocode:", "
switch (num) {
case value1:
statement1
break;
value2:
statement2;
break;
...
valueN:
statementN;
}
", "case values are tested with strict equality (===). The break tells Javascript to stop executing statements. If the break is omitted, the next statement will be executed.", - "

Instructions

Write a switch statement to set answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" + "

Instructions

", + "Write a switch statement to set answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" ], "releasedOn": "11/27/2015", "tests": [ @@ -3009,7 +3073,8 @@ "In a switch statement you may not be able to specify all possible values as case statements. Instead, you can use the default statement where a case would go. Think of it like an else statement for switch.", "A default statement should be the last \"case\" in the list.", "
switch (num) {
case value1:
statement1
break;
value2:
statement2;
break;
...
default:
defaultStatement;
}
", - "

Instructions

Write a switch statement to set answer for the following conditions:
\"a\" - \"apple\"
\"b\" - \"bird\"
\"c\" - \"cat\"
default - \"stuff\"" + "

Instructions

", + "Write a switch statement to set answer for the following conditions:
\"a\" - \"apple\"
\"b\" - \"bird\"
\"c\" - \"cat\"
default - \"stuff\"" ], "releasedOn": "11/27/2015", "tests": [ @@ -3071,7 +3136,8 @@ "If the break statement is ommitted from a switch statement case, the following case statement(s). If you have mutiple inputs with the same output, you can represent them in a switch statement like this:", "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", "Cases for 1, 2, and 3 will all produce the same result.", - "

Instructions

Write a switch statement to set answer for the following ranges:
1-3 - \"Low\"
4-6 - \"Mid\"
7-9 - \"High\"", + "

Instructions

", + "Write a switch statement to set answer for the following ranges:
1-3 - \"Low\"
4-6 - \"Mid\"
7-9 - \"High\"", "Note
You will need to have a case statement for each number in the range." ], "releasedOn": "11/27/2015", @@ -3143,7 +3209,8 @@ "
if(val === 1) {
answer = \"a\";
} else if(val === 2) {
answer = \"b\";
} else {
answer = \"c\";
}
", "can be replaced with:", "
switch (val) {
case 1:
answer = \"a\";
break;
case 2:
answer = \"b\";
break;
default:
answer = \"c\";
}
", - "

Instructions

Change the chained if/if else statements into a switch statement." + "

Instructions

", + "Change the chained if/if else statements into a switch statement." ], "releasedOn": "11/27/2015", "tests": [ @@ -3287,7 +3354,8 @@ "Here's a sample object:", "
var cat = {
\"name\": \"Whiskers\",
\"legs\": 4,
\"tails\": 1,
\"enemies\": [\"Water\", \"Dogs\"]
};
", "Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.", - "

Instructions

Make an object that represents a dog called myDog which contains the properties \"name\" (a string), \"legs\", \"tails\" and \"friends\".", + "

Instructions

", + "Make an object that represents a dog called myDog which contains the properties \"name\" (a string), \"legs\", \"tails\" and \"friends\".", "You can set these object properties to whatever values you want, as long \"name\" is a string, \"legs\" and \"tails\" are numbers, and \"friends\" is an array." ], "tests": [ @@ -3331,7 +3399,8 @@ "The dot operator is what you use when you know the name of the property you're trying to access ahead of time.", "Here is a sample of using the . to read an object property:", "
var myObj = {
prop1: \"val1\",
prop2: \"val2\"
};
myObj.prop1; // val1
myObj.prop2; // val2
", - "

Instructions

Read the values of the properties hat and shirt of testObj using dot notation." + "

Instructions

", + "Read the values of the properties hat and shirt of testObj using dot notation." ], "releasedOn": "11/27/2015", "tests": [ @@ -3382,7 +3451,8 @@ "Here is a sample of using bracket notation to read an object property:", "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", "Note that property names with spaces in them must be in quotes (single or double).", - "

Instructions

Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation." + "

Instructions

", + "Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation." ], "releasedOn": "11/27/2015", "tests": [ @@ -3433,7 +3503,8 @@ "Here is an example of using a variable to access a property:", "
var someProp = \"propName\";
var myObj = {
propName: \"Some Value\"
}
myObj[someProp]; // \"Some Value\"
", "Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name", - "

Instructions

Use the playerNumber variable to lookup player 16 in testObj using bracket notation." + "

Instructions

", + "Use the playerNumber variable to lookup player 16 in testObj using bracket notation." ], "releasedOn": "11/27/2015", "tests": [ @@ -3480,7 +3551,8 @@ "ourDog.name = \"Happy Camper\"; or", "outDog[\"name\"] = \"Happy Camper\";", "Now when we evaluate ourDog.name, instead of getting \"Camper\", we'll get his new name, \"Happy Camper\".", - "

Instructions

Update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\". You can use either dot or bracket notation." + "

Instructions

", + "Update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\". You can use either dot or bracket notation." ], "tests": [ "assert(/happy coder/gi.test(myDog.name), 'message: Update myDog's \"name\" property to equal \"Happy Coder\".');", @@ -3525,7 +3597,8 @@ "or", "ourDog[\"bark\"] = \"bow-wow\";", "Now when we evaluate ourDog.bark, we'll get his bark, \"bow-wow\".", - "

Instructions

Add a \"bark\" property to myDog and set it to a dog sound, such as \"woof\". You may use either dot or bracket notation." + "

Instructions

", + "Add a \"bark\" property to myDog and set it to a dog sound, such as \"woof\". You may use either dot or bracket notation." ], "tests": [ "assert(myDog.bark !== undefined, 'message: Add the property \"bark\" to myDog.');", @@ -3574,7 +3647,8 @@ "description": [ "We can also delete properties from objects like this:", "delete ourDog.bark;", - "

Instructions

Delete the \"tails\" property from myDog. You may use either dot or bracket notation." + "

Instructions

", + "Delete the \"tails\" property from myDog. You may use either dot or bracket notation." ], "tests": [ "assert(myDog.tails === undefined, 'message: Delete the property \"tails\" from myDog.');", @@ -3629,7 +3703,8 @@ "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if...else chain. This is most useful when you know that your input data is limited to a certain range.", "Here is an example of a simple reverse alphabet lookup:", "
var alpha = {
1:\"Z\"
2:\"Y\"
3:\"X\"
...
4:\"W\"
24:\"C\"
25:\"B\"
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", - "

Instructions

Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." + "

Instructions

", + "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." ], "releasedOn": "11/27/2015", "tests": [ @@ -3727,7 +3802,8 @@ "Here is an example of a JSON object:", "
var ourMusic = [
{
\"artist\": \"Daft Punk\",
\"title\": \"Homework\",
\"release_year\": 1997,
\"formats\": [
\"CD\",
\"Cassette\",
\"LP\" ],
\"gold\": true
}
];
", "This is an array of objects and the object has various peices of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", - "

Instructions

Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." + "

Instructions

", + "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." ], "releasedOn": "11/27/2015", "tests": [ @@ -3802,7 +3878,8 @@ "The properties and sub-properties of JSON objects can be accessed by chaining together the dot or bracket notation.", "Here is a nested JSON Object:", "
var ourStorage = {
\"desk\": {
\"drawer\": \"stapler\"
},
\"cabinet\": {
\"top drawer\": {
\"folder1\": \"a file\",
\"folder2\": \"secrets\"
},
\"bottom drawer\": \"soda\"
}
}
ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"
ourStoage.desk.drawer; // \"stapler\"
", - "

Instructions

Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." + "

Instructions

", + "Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." ], "releasedOn": "11/27/2015", "tests": [ @@ -3860,7 +3937,8 @@ "As we have seen in earlier examples, JSON objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.", "Here is an example of how to access a nested array:", "
var ourPets = {
\"cats\": [
\"Meowzer\",
\"Fluffy\",
\"Kit-Cat\"
],
\"dogs:\" [
\"Spot\",
\"Bowser\",
\"Frankie\"
]
};
ourPets.cats[1]; // \"Fluffy\"
ourPets.dogs[0]; // \"Spot\"
", - "

Instructions

Retrieve the second tree using object dot and array bracket notation." + "

Instructions

", + "Retrieve the second tree using object dot and array bracket notation." ], "releasedOn": "11/27/2015", "tests": [ @@ -3976,7 +4054,8 @@ "In the following example we initialize with i = 0 and iterate while our condition i < 5 is true. We'll increment i by 1 in each loop iteration with i++ as our final-expression.", "
var ourArray = [];
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
", "ourArray will now contain [0,1,2,3,4].", - "

Instructions

Use a for loop to work to push the values 1 through 5 onto myArray." + "

Instructions

", + "Use a for loop to work to push the values 1 through 5 onto myArray." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", @@ -4012,7 +4091,8 @@ "
var ourArray = [];
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
", "ourArray will now contain [0,2,4,6,8].", "Let's change our initialization so we can count by odd numbers.", - "

Instructions

Push the odd numbers from 1 through 9 to myArray using a for loop." + "

Instructions

", +"Push the odd numbers from 1 through 9 to myArray using a for loop." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", @@ -4049,7 +4129,8 @@ "
var ourArray = [];
for (var i=10; i > 0; i-=2) {
ourArray.push(i);
}
", "ourArray will now contain [10,8,6,4,2].", "Let's change our initialization and final-expression so we can count backward by twos by odd numbers.", - "

Instructions

Push the odd numbers from 9 through 1 to myArray using a for loop." + "

Instructions

", +"Push the odd numbers from 9 through 1 to myArray using a for loop." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", @@ -4082,7 +4163,8 @@ "A common task in Javascript is to iterate through the contents of an array. One way to do that is with a for loop. This code will output each element of the array arr to the console:", "
var arr = [10,9,8,7,6];
for (var i=0; i < arr.length; i++) {
console.log(arr[i]);
}
", "Remember that Arrays have zero-based numbering, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops when i is at length - 1.", - "

Instructions

Create a variable total. Use a for loop to add each element of myArr to total." + "

Instructions

", + "Create a variable total. Use a for loop to add each element of myArr to total." ], "releasedOn": "11/27/2015", "tests": [ @@ -4132,7 +4214,8 @@ "If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:", "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; k < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", "This outputs each sub-element in arr one at a time. Note that for the inner loop we are checking the .length of arr[i], since arr[i] is itself an array.", - "

Instructions

The function multiplyAll will be passed a multi-dimensional array, arr. Loop through both levels of arr and multiply product by each one." + "

Instructions

", + "Modify function multiplyAll so that it multiplies product by each number in the subarrays of arr" ], "releasedOn": "11/27/2015", "tests": [ @@ -4187,7 +4270,8 @@ "Another type of JavaScript loop is called a \"while loop\", because it runs \"while\" something is true and stops once that something is no longer true.", "
var ourArray = [];
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
", "Let's try getting a while loop to work by pushing values to an array.", - "

Instructions

Push the numbers 0 through 4 to myArray using a while loop." + "

Instructions

", + "Push the numbers 0 through 4 to myArray using a while loop." ], "tests": [ "assert(editor.getValue().match(/while/g), 'message: You should be using a while loop for this.');", @@ -5131,4 +5215,4 @@ "challengeType": "0" } ] -} \ No newline at end of file +} diff --git a/server/views/coursewares/showBonfire.jade b/server/views/coursewares/showBonfire.jade index fdd408fd67..ca5a901d0e 100644 --- a/server/views/coursewares/showBonfire.jade +++ b/server/views/coursewares/showBonfire.jade @@ -15,7 +15,10 @@ block content .col-xs-12 .bonfire-instructions for sentence in details - p.wrappable.negative-10!= sentence + if (/blockquote|h4/.test(sentence)) + !=sentence + else + p.wrappable.negative-10!= sentence .negative-30-bottom #MDN-links p.negative-10 Here are some helpful links: diff --git a/server/views/coursewares/showJS.jade b/server/views/coursewares/showJS.jade index 3b4c1131b4..470edd6417 100644 --- a/server/views/coursewares/showJS.jade +++ b/server/views/coursewares/showJS.jade @@ -14,7 +14,10 @@ block content .col-xs-12 .bonfire-instructions for sentence in details - p.wrappable.negative-10!= sentence + if (/blockquote|h4/.test(sentence)) + !=sentence + else + p.wrappable.negative-10!= sentence .negative-bottom-margin-30 #MDN-links p.negative-10 Here are some helpful links: From e615c4b56a2d145900f41528fe84ecc387d6219e Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 22 Dec 2015 14:44:48 -0800 Subject: [PATCH 014/174] More Challenges, Reorder --- .../basic-javascript.json | 212 ++++++++++-------- 1 file changed, 116 insertions(+), 96 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 305ea24fd4..146062cc1d 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1989,48 +1989,35 @@ "
var someVar = \"Hat\";
function myFun() {
var someVar = \"Head\";
return someVar;
}
", "The function myFun will return \"Head\" because the local version of the variable is present.", "

Instructions

", - "Add a local variable to myFunction to override the value of " + "Add a local variable to myFunction to override the value of outerWear with \"sweater\"." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert(outerWear === \"T-Shirt\", 'message: Do not change the value of the global outerWear');", + "assert(myFunction() === \"sweater\", 'message: myFunction should return \"sweater\"');", + "assert(/return outerWear/.test(editor.getValue()), 'message: Do not change the return statement');" ], "challengeSeed": [ + "// Setup", + "var outerWear = \"T-Shirt\";", + "", + "function myFunction() {", + " // Only change code below this line", "", "", - "" + "", + " // Only change code above this line", + " return outerWear;", + "}", + "", + "myFunction();" ], "solutions": [ - "" - ], - "type": "waypoint", - "challengeType": "1", - "nameCn": "", - "nameFr": "", - "nameRu": "", - "nameEs": "", - "namePt": "" - }, - { - "id": "56533eb9ac21ba0edf2244c1", - "title": "Context for Functions", - "description": [ - "Show how each instance of a function has its own values/context" - ], - "releasedOn": "11/27/2015", - "tests": [ - "assert(1===1, 'message: message here');" - ], - "challengeSeed": [ - "", - "", - "" - ], - "tail": [ - "" - ], - "solutions": [ - "" + "var outerWear = \"T-Shirt\";", + "function myFunction() {", + " var outerWear = \"sweater\";", + " return outerWear;", + "}" ], "type": "waypoint", "challengeType": "1", @@ -2092,77 +2079,23 @@ "Assume we have pre-defined a function sum which adds two numbers together, then: ", "var ourSum = sum(5, 12);", "will call sum, which returns a value of 17 and assigns it to ourSum.", - "

Instructions

" + "

Instructions

", + "Call process with an argument of 7 and assign it's return valueto the variable processed." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert(processed === 2, 'message: processed should have a value of 10');", + "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(editor.getValue()), 'message: You should assign process to processed');" ], "challengeSeed": [ "// Setup", + "var processed = 0;", + "", "function process(num) {", " return (num + 3) / 5;", "}", "", "// Only change code below this line", - "var processed = 0; // Change this line", - "" - ], - "tail": [ - "" - ], - "solutions": [ - "" - ], - "type": "waypoint", - "challengeType": "1", - "nameCn": "", - "nameFr": "", - "nameRu": "", - "nameEs": "", - "namePt": "" - }, - { - "id": "56533eb9ac21ba0edf2244c4", - "title": "Return Early Pattern for Functions", - "description": [ - "Explain how to use return early for functions" - ], - "releasedOn": "11/27/2015", - "tests": [ - "assert(1===1, 'message: message here');" - ], - "challengeSeed": [ - "", - "", - "" - ], - "tail": [ - "" - ], - "solutions": [ - "" - ], - "type": "waypoint", - "challengeType": "1", - "nameCn": "", - "nameFr": "", - "nameRu": "", - "nameEs": "", - "namePt": "" - }, - { - "id": "56533eb9ac21ba0edf2244c5", - "title": "Optional Arguments for Functions", - "description": [ - "" - ], - "releasedOn": "11/27/2015", - "tests": [ - "assert(1===1, 'message: message here');" - ], - "challengeSeed": [ - "", "", "" ], @@ -2759,7 +2692,7 @@ "nameEs": "", "namePt": "" }, - { + { "id": "5664820f61c48e80c9fa476c", "title": "Golf Code", "description": [ @@ -3279,6 +3212,93 @@ "nameEs": "", "namePt": "" }, + { + "id": "5679ceb97cbaa8c51670a16b", + "title": "Returning Boolean Values from Functions", + "description": [ + "Explain how to return booleans vs. if/else " + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c4", + "title": "Return Early Pattern for Functions", + "description": [ + "Explain how to use return early for functions" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, + { + "id": "56533eb9ac21ba0edf2244c5", + "title": "Optional Arguments for Functions", + "description": [ + "" + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(1===1, 'message: message here');" + ], + "challengeSeed": [ + "", + "", + "" + ], + "tail": [ + "" + ], + "solutions": [ + "" + ], + "type": "waypoint", + "challengeType": "1", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, { "id": "565bbe00e9cc8ac0725390f4", "title": "Counting Cards", @@ -4092,7 +4112,7 @@ "ourArray will now contain [0,2,4,6,8].", "Let's change our initialization so we can count by odd numbers.", "

Instructions

", -"Push the odd numbers from 1 through 9 to myArray using a for loop." + "Push the odd numbers from 1 through 9 to myArray using a for loop." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", @@ -4130,7 +4150,7 @@ "ourArray will now contain [10,8,6,4,2].", "Let's change our initialization and final-expression so we can count backward by twos by odd numbers.", "

Instructions

", -"Push the odd numbers from 9 through 1 to myArray using a for loop." + "Push the odd numbers from 9 through 1 to myArray using a for loop." ], "tests": [ "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", From 14e02c3b460a806f92a703e905e8c62312f51e66 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 22 Dec 2015 21:20:41 -0800 Subject: [PATCH 015/174] More Challeges --- .../basic-javascript.json | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 146062cc1d..8aceff6e3b 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2117,7 +2117,13 @@ "id": "56533eb9ac21ba0edf2244c6", "title": "Checkpoint: Functions", "description": [ - "Note: Function Length tips - 10-20 lines, etc" + "Note: Function Length tips - 10-20 lines, etc", + "\"Queue\"", + "myFunction(arr, item)", + "", + "Push item on end of array", + "pop item off front", + "" ], "releasedOn": "11/27/2015", "tests": [ @@ -2132,7 +2138,12 @@ "" ], "solutions": [ - "" + "var arr = [ 1,2,3,4,5];", + "", + "function queue(myArr, item) {", + " myArr.push(item);", + " return myArr.shift();", + "}" ], "type": "waypoint", "challengeType": "1", @@ -2692,7 +2703,7 @@ "nameEs": "", "namePt": "" }, - { + { "id": "5664820f61c48e80c9fa476c", "title": "Golf Code", "description": [ @@ -3216,7 +3227,8 @@ "id": "5679ceb97cbaa8c51670a16b", "title": "Returning Boolean Values from Functions", "description": [ - "Explain how to return booleans vs. if/else " + "You may recall from Comparison with the Equality Operator that all comparison operators return a boolean true or false value.", + "A common anti-pattern is to use an if/else statement to do a comparison and then return true/false." ], "releasedOn": "11/27/2015", "tests": [ @@ -4035,7 +4047,7 @@ "id": "56533eb9ac21ba0edf2244cf", "title": "Checkpoint: Objects", "description": [ - "" + "Update a JSON or other Object with a property name and value passed in variables" ], "releasedOn": "11/27/2015", "tests": [ @@ -5235,4 +5247,4 @@ "challengeType": "0" } ] -} +} \ No newline at end of file From d3ff5ec92251f1e961da7c2a6ca453f732c64c1d Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 04:39:38 +0530 Subject: [PATCH 016/174] Understand Boolean Values --- .../basic-javascript.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 8aceff6e3b..8579d6cac2 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -28,10 +28,11 @@ "id": "bd7123c9c441eddfaeb5bdef", "title": "Understand Boolean Values", "description": [ - "In computer science, data structures are things that hold data. JavaScript has seven of these. For example, the Number data structure holds numbers.", - "Let's learn about the most basic data structure of all: the Boolean. Booleans can only hold the value of either true or false. They are basically little on-off switches.", + "Computers are not inherently smart. Hence, javascript developers made it easy for us to represent data to computer. Data is anything that is meaningful to the computer.", + "In computer science, Data types are things that represent various types of data. JavaScript has seven data types which are Undefined, Null, Boolean, String, Symbol, Number, and Object. For example, the Number data type represents numbers.", + "Now let's learn about the most basic one: the Boolean data type. Booleans represent a true or false value. They are basically little on-off switches.", "

Instructions

", - "Modify the welcomeToBooleans function so that it will return true instead of false when the run button is clicked." + "Modify the welcomeToBooleans function so that it returns true instead of false when the run button is clicked." ], "tests": [ "assert(typeof(welcomeToBooleans()) === 'boolean', 'message: The welcomeToBooleans() function should return a boolean (true/false) value.');", From 59f62e09ce1b752332cdf8a87785ea31ec980cf5 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 04:40:12 +0530 Subject: [PATCH 017/174] Declare JavaScript Variables --- .../basic-javascript.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 8579d6cac2..b05e9c2c3f 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -58,11 +58,12 @@ "id": "bd7123c9c443eddfaeb5bdef", "title": "Declare JavaScript Variables", "description": [ - "When we store data in a data structure, we call it a variable. These variables are no different from the x and y variables you use in math.", - "Let's create our first variable and call it \"myName\".", - "You'll notice that in myName, we didn't use a space, and that the \"N\" is capitalized. JavaScript variables are written in camel case. An example of camel case is: camelCase.", + "It's nice to have seven different ways of representing data. But to use them in other parts of code, we must store the data somewhere. In computer science, the placeholder where data is stored for further use is known as variable.", + "These variables are no different from the x and y variables you use in Maths. Which means they're just a simple name to represent the data we want to refer to.", + "Now let's create our first variable and call it \"myName\".", + "You'll notice that in myName, we didn't use a space, and that the \"N\" is capitalized. In JavaScript, we write variable names in \"camelCase\".", "

Instructions

", - "Use the var keyword to create a variable called myName. Set its value to your name, in double quotes.", + "Use the var keyword to create a variable called myName. Set its value to your name, wrapped in double quotes.", "Hint", "Look at the ourName example if you get stuck." ], @@ -88,7 +89,7 @@ "description": [ "In Javascript, you can store a value in a variable with the = or assignment operator.", "myVariable = 5;", - "Assigns the value 5 to myVariable.", + "Assigns the Number value 5 to myVariable.", "Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.", "myVar = 5;", "myNum = myVar;", From dda478e7eb22b6b34b629891241a9da56ce0bb49 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 05:26:20 +0530 Subject: [PATCH 018/174] Storing Values with the Equal Operator Incomplete --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index b05e9c2c3f..965ed39957 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -118,9 +118,9 @@ ], "solutions": [ "var a;", - "var b=2;", + "var b = 2;", "a = 7;", - "b = a;7" + "b = a;" ], "type": "waypoint", "challengeType": "1", From e23fc081810d5421b28d08d3082ef6acce628179 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 05:54:55 +0530 Subject: [PATCH 019/174] Initializing Variables with the Equal Operator --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 965ed39957..975a4c1da8 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -134,7 +134,7 @@ "id": "56533eb9ac21ba0edf2244a9", "title": "Initializing Variables with the Equal Operator", "description": [ - "It is common to initialize a variable to a starting value on the same line as it is defined.", + "It is common to initialize a variable to an initial value in the same line as it is declared.", "", "var myVar = 0;", "Creates a new variable called myVar and assigns it an inital value of 0.", From 0b8044e6080a57b5e3bfdc942281c746ba191470 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 06:44:37 +0530 Subject: [PATCH 020/174] Understanding Uninitialized Variables --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 975a4c1da8..654c9ca438 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -171,7 +171,7 @@ "id": "56533eb9ac21ba0edf2244aa", "title": "Understanding Uninitialized Variables", "description": [ - "When Javascript variables are declared, they have an inital value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatanate a string with an undefined variable, you will get a literal string of \"undefined\".", + "When Javascript variables are declared, they have an inital value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatanate a string with an undefined variable, you will get a literal string of \"undefined\".", "

Instructions

", "Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." ], From 0f117cd9b5eb6f827c32da6ae13769c180816372 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 08:15:37 +0530 Subject: [PATCH 021/174] Understanding Case Sensitivity in Variables --- .../basic-javascript.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 654c9ca438..ed7b654e9e 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -219,9 +219,10 @@ "title": "Understanding Case Sensitivity in Variables", "description": [ "In Javascript all variables and function names are case sensitive. This means that capitalization matters.", - "MYVAR is not the same as MyVar nor myvar. It is possible to have mulitpe distinct variables with the same name but different capitalization. It is strongly reccomended that for sake of clarity you do not use this language feature.", - "

Best Practice

Variables in Javascript should use camelCase. In camelCase, variables made of multiple words have the first word in all lowercase and the first letter of each subsequent word capitalized.
", - "Examples:
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", + "MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly reccomended that for sake of clarity you do not use this language feature.", + "

Best Practice

Write variable names in Javascript in camelCase. In camelCase, variable names made of multiple words have the first word in all lowercase and the first letter of each subsequent word(s) capitalized.
", + " ", + "Examples:
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", "

Instructions

", "Correct the variable assignements so their names match their variable declarations above." ], From e616d25a8407848e5035781708947736b8381cda Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 23 Dec 2015 18:50:43 -0800 Subject: [PATCH 022/174] More Challenges --- .../basic-javascript.json | 156 +++++++++++++++--- 1 file changed, 131 insertions(+), 25 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index ed7b654e9e..3625ddb628 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2118,27 +2118,52 @@ }, { "id": "56533eb9ac21ba0edf2244c6", - "title": "Checkpoint: Functions", + "title": "Stand in Line", "description": [ - "Note: Function Length tips - 10-20 lines, etc", - "\"Queue\"", - "myFunction(arr, item)", - "", - "Push item on end of array", - "pop item off front", - "" + "In Computer Science a queue is an abastract datatype where items are kept in order. New items can be added to the back of the queue and old items are taken off the front of the queue.", + "Write a function queue which takes an array and an item as arguments. Add the item onto the end of the array, then remove and return the item at the front of the queue." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert(queue([],1) === 1, 'message: queue([], 1) should return 1');", + "assert(queue([2],1) === 2, 'message: queue([2], 1) should return 2');", + "queue(myArr, 10); assert(myArr[4] === 10, 'message: After queue(myArr, 10), myArr[4] should be 10');" + ], + "head": [ + "var logOutput = [];", + "var oldLog = console.log;", + "function capture() {", + " console.log = function (message) {", + " logOutput.push(message);", + " oldLog.apply(console, arguments);", + " };", + "}", + "", + "function uncapture() {", + " console.log = oldLog;", + "}", + "", + "capture();" ], "challengeSeed": [ + "// Setup", + "var myArr = [1,2,3,4,5];", "", + "function queue(arr, item) {", + " // Your code here", + " ", + " return item; // Change this line", + "}", "", - "" + "// Display Code", + "console.log(\"Before: \" + JSON.stringify(myArr));", + "console.log(queue(myArr, 6)); // Modify this line to test", + "console.log(\"After: \" + JSON.stringify(myArr));" ], "tail": [ - "" + "uncapture();", + "myArr = [1,2,3,4,5];", + "(function() { return logOutput.join(\"\\n\");})();" ], "solutions": [ "var arr = [ 1,2,3,4,5];", @@ -2148,8 +2173,8 @@ " return myArr.shift();", "}" ], - "type": "waypoint", - "challengeType": "1", + "type": "bonfire", + "challengeType": "5", "nameCn": "", "nameFr": "", "nameRu": "", @@ -3231,16 +3256,31 @@ "title": "Returning Boolean Values from Functions", "description": [ "You may recall from Comparison with the Equality Operator that all comparison operators return a boolean true or false value.", - "A common anti-pattern is to use an if/else statement to do a comparison and then return true/false." + "A common anti-pattern is to use an if/else statement to do a comparison and then return true/false:", + "
function isEqual(a,b) {
if(a === b) {
return true;
} else {
return false;
}
}
", + "Since === returns true or false, we can simply return the result of the comparion:", + "
function isEqual(a,b) {
return a === b;
}
", + "

Instructions

", + "Fix the function isLess to remove the if/else statements." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert(isLess(10,15) === true, 'message: isLess(10,15) should return true');", + "assert(isLess(15, 10) === false, 'message: isLess(15,10) should return true');", + "assert(!/if|else/g.test(editor.getValue()), 'message: You should not use any if or else statements');" ], "challengeSeed": [ + "function isLess(a, b) {", + " // Fix this code", + " if(a < b) {", + " return true;", + " } else {", + " return false;", + " }", + "}", "", - "", - "" + "// Change these values to test", + "isLess(10, 15);" ], "tail": [ "" @@ -3260,7 +3300,7 @@ "id": "56533eb9ac21ba0edf2244c4", "title": "Return Early Pattern for Functions", "description": [ - "Explain how to use return early for functions" + "When a return statement is reached, the execution of the current function stops at that point. " ], "releasedOn": "11/27/2015", "tests": [ @@ -3829,6 +3869,58 @@ "nameEs": "", "namePt": "" }, + { + "id": "567af2437cbaa8c51670a16c", + "title": "Testing Objects for Properties", + "description": [ + "Sometimes it is useful to check of the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.", + "Example:", + "
var myObj = {
top: \"hat\",
bottom: \"pants\"
};
myObj.hasOwnProperty(\"hat\"); // true
myObj.hasOwnProperty(\"middle\"); // false
", + "

Instructions

", + " Modify function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not return \"Not Found\"." + ], + "tests": [ + "assert(checkObj(\"gift\") === \"pony\", 'message: checkObj(\"gift\") should return \"pony\".');", + "assert(checkObj(\"pet\") === \"kitten\", 'message: checkObj(\"gift\") should return \"kitten\".');", + "assert(checkObj(\"house\") === \"Not Found\", 'message: checkObj(\"house\") should return \"Not Found\".');" + ], + "challengeSeed": [ + "// Setup", + "var myObj = {", + " gift: \"pony\",", + " pet: \"kitten\",", + " bed: \"sleigh\"", + "};", + "", + "function checkObj(checkProp) {", + " // Your Code Here", + "", + " return \"Change Me!\";", + "}", + "", + "// Test your code by modifying these values", + "checkObj(\"gift\");" + ], + "tail": [ + "" + ], + "solutions": [ + "var myObj = {", + " gift: \"pony\",", + " pet: \"kitten\",", + " bed: \"sleigh\"", + "};", + "function checkObj(checkProp) {", + " if(myObj.hasOwnProperty(checkProp)) {", + " return myObj[checkProp];", + " } else {", + " return \"Not Found\";", + " }", + "}" + ], + "type": "waypoint", + "challengeType": "1" + }, { "id": "56533eb9ac21ba0edf2244cb", "title": "Introducing JavaScript Object Notation (JSON)", @@ -4022,9 +4114,9 @@ }, { "id": "56533eb9ac21ba0edf2244ce", - "title": "Arbitrary Nesting in JSON", + "title": "Modifying JSON Values", "description": [ - "Retrieve a value from an arbitary JSON" + "Modify the contents of a JSON object" ], "releasedOn": "11/27/2015", "tests": [ @@ -4035,6 +4127,9 @@ "", "" ], + "tail": [ + "" + ], "solutions": [ "" ], @@ -4328,24 +4423,35 @@ }, { "id": "56533eb9ac21ba0edf2244e2", - "title": "Checkpoint: Conditionals and Loops", + "title": "Caesar's Cipher", "description": [ - "" + "One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount. ", + "A common modern use is a ROT13 cipher, where the values of the letters are shifted by 13 places. Thus A = N, B = O and so on.", + "Write a function which takes a ROT13 encoded array of characters as input and returns a plain text encoded array. All letters will be uppercase. Do not transform any non-alphabetic character (IE: spaces, punctiation)." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert( rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]).join(\"\") === \"FREE CODE CAMP\", 'message: rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]) should decode to [ 'F', 'R', 'E', 'E', ' ', 'C', 'O', 'D', 'E', ' ', 'C', 'A', 'M', 'P' ]');", + "assert(1===1, 'message: blah');" ], "challengeSeed": [ + "function rot13(codeArr) {", + " // Your Code Here", "", + " return []; // Change this Line", + "}", "", + "// Change the inputs below to test", + "rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]);" + ], + "tail": [ "" ], "solutions": [ "" ], - "type": "waypoint", - "challengeType": "1", + "type": "bonfire", + "challengeType": "5", "nameCn": "", "nameFr": "", "nameRu": "", From 62598d111f3375f37dd85bc2473647741f9c0aaa Mon Sep 17 00:00:00 2001 From: Akira Laine Date: Thu, 24 Dec 2015 19:27:02 +1100 Subject: [PATCH 023/174] Update basic-javascript.json --- .../basic-javascript.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 3625ddb628..b6ca72b64e 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -346,10 +346,10 @@ "We can also divide one number by another.", "JavaScript uses the / symbol for division.", "

Instructions

", - "Change the 0 so that quotient will equal 2." + "Change the 0 so that answer will equal 2." ], "tests": [ - "assert(quotient === 2, 'message: Make the variable quotient equal 2.');", + "assert(answer === 2, 'message: Make the variable answer equal 2.');", "assert(/\\d+\\s*\\/\\s*\\d+/.test(editor.getValue()), 'message: Use the / operator');" ], "challengeSeed": [ @@ -358,7 +358,7 @@ "" ], "tail": [ - "(function(z){return 'quotient = '+z;})(quotient);" + "(function(z){return 'answer = '+z;})(answer);" ], "type": "waypoint", "challengeType": "1" @@ -975,7 +975,7 @@ "id": "56533eb9ac21ba0edf2244b8", "title": "Concatanting Strings with the Plus Equals Operator", "description": [ - "We can also use the += operator to concatanae a string onto the end of an existing string. This can be very helpful to break a long string over several lines.", + "We can also use the += operator to concatanate a string onto the end of an existing string. This can be very helpful to break a long string over several lines.", "

Instructions

", "Build myStr over several lines by concatanating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." ], @@ -1650,10 +1650,10 @@ "id": "bg9997c9c69feddfaeb9bdef", "title": "Manipulate Arrays With unshift()", "description": [ - "Not only can you shift elements off of the beginning of an array, you can also unshift elements onto the beginning of an array.", + "Not only can you shift elements off of the beginning of an array, you can also unshift elements to the beginning of an array.", "unshift() works exactly like push(), but instead of adding the element at the end of the array, unshift() adds the element at the beginning of the array.", "

Instructions

", - "Add [\"Paul\",35] onto the beginning of the myArray variable using unshift()." + "Add [\"Paul\",35] to the beginning of the myArray variable using unshift()." ], "tests": [ "assert((function(d){if(typeof(d[0]) === \"object\" && d[0][0].toLowerCase() == 'paul' && d[0][1] == 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), 'message: myArray should now have [[\"Paul\", 35], [\"dog\", 3]]).');" @@ -5356,4 +5356,4 @@ "challengeType": "0" } ] -} \ No newline at end of file +} From ec1ca9081f2010da2d0013c59291725a78961bc0 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 24 Dec 2015 08:37:35 -0800 Subject: [PATCH 024/174] Fixed Spelling Error --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index b6ca72b64e..58e7f00bf4 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -977,7 +977,7 @@ "description": [ "We can also use the += operator to concatanate a string onto the end of an existing string. This can be very helpful to break a long string over several lines.", "

Instructions

", - "Build myStr over several lines by concatanating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." + "Build myStr over several lines by concatenating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." ], "releasedOn": "11/27/2015", "tests": [ From 979910fa5b1847c1167dcc7c69ae4d956fb41ba9 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 09:09:20 +0530 Subject: [PATCH 025/174] Add Two Numbers with JavaScript Signed-off-by: Abhisek Pattnaik --- .../basic-javascript.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 58e7f00bf4..4774f05d7b 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -266,8 +266,12 @@ "id": "cf1111c1c11feddfaeb3bdef", "title": "Add Two Numbers with JavaScript", "description": [ - "Let's try to add two numbers using JavaScript.", - "JavaScript uses the + symbol for addition.", + "Number is another data type in JavaScript which represents numeric data.", + "Now let's try to add two numbers using JavaScript.", + "JavaScript uses the + symbol as addition operation when placed between two numbers.", + "", + "Example
5 + 10 = 15
", + "", "

Instructions

", "Change the 0 so that sum will equal 20." ], From 72eb960de032ddaa6c217ebbcdd7218296a3e7cf Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 12:12:55 +0530 Subject: [PATCH 026/174] Subtract One Number from Another with JavaScript --- .../basic-javascript.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 4774f05d7b..6fd54770a5 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -295,6 +295,9 @@ "description": [ "We can also subtract one number from another.", "JavaScript uses the - symbol for subtraction.", + "", + "Example
12 - 6 = 6
", + "", "

Instructions

", "Change the 0 so that difference will equal 12." ], From be6bdd6228c51d83a7067a79d6fe2765ebfa0bc6 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 11:58:47 +0530 Subject: [PATCH 027/174] Multiply Two Numbers with JavaScript --- .../basic-javascript.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 6fd54770a5..cab00f6f2a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -324,7 +324,10 @@ "title": "Multiply Two Numbers with JavaScript", "description": [ "We can also multiply one number by another.", - "JavaScript uses the * symbol for multiplication.", + "JavaScript uses the * symbol for multiplication of two numbers.", + "", + "Example
13 * 13 = 169
", + "", "

Instructions

", "Change the 0 so that product will equal 80." ], From 7bf255e47cb354547255bbce4c79417c441ef319 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 12:28:07 +0530 Subject: [PATCH 028/174] Divide One Number by Another with JavaScript --- .../basic-javascript.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index cab00f6f2a..b253f42162 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -355,11 +355,14 @@ "description": [ "We can also divide one number by another.", "JavaScript uses the / symbol for division.", + "", + "Example
16 / 2 = 8
", + "", "

Instructions

", - "Change the 0 so that answer will equal 2." + "Change the 0 so that quotient will equal to 2." ], "tests": [ - "assert(answer === 2, 'message: Make the variable answer equal 2.');", + "assert(quotient === 2, 'message: Make the variable quotient equal to 2.');", "assert(/\\d+\\s*\\/\\s*\\d+/.test(editor.getValue()), 'message: Use the / operator');" ], "challengeSeed": [ @@ -368,7 +371,7 @@ "" ], "tail": [ - "(function(z){return 'answer = '+z;})(answer);" + "(function(z){return 'quotient = '+z;})(quotient);" ], "type": "waypoint", "challengeType": "1" From b876fd76fbaf38abe9d5d9c34be6daac5fd7afd4 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 12:50:21 +0530 Subject: [PATCH 029/174] Increment a Number with Javascript --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index b253f42162..60c92b2796 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -380,7 +380,7 @@ "id": "56533eb9ac21ba0edf2244ac", "title": "Increment a Number with Javascript", "description": [ - "You can easily increment or add one to a Javascript variable with the ++ operator.", + "You can easily increment or add one to a variable with the ++ operator.", "i++;", "is the equivilent of", "i = i + 1;", From d3e610f6e278b51f779717d123d1356b01fcd894 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 12:59:03 +0530 Subject: [PATCH 030/174] Decrement a Number with Javascript --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 60c92b2796..3e420cfd82 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -419,7 +419,7 @@ "id": "56533eb9ac21ba0edf2244ad", "title": "Decrement a Number with Javascript", "description": [ - "You can easily decrement or decrease by one a Javascript variable with the -- operator.", + "You can easily decrement or decrease a variable by one with the -- operator.", "i--;", "is the equivilent of", "i = i - 1;", From 22e5e895acbe2b4d037e9a9eea2f5bed7e032691 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 14:49:26 +0530 Subject: [PATCH 031/174] Create Decimal Numbers with JavaScript --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 3e420cfd82..382509f55c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -458,9 +458,9 @@ "id": "cf1391c1c11feddfaeb4bdef", "title": "Create Decimal Numbers with JavaScript", "description": [ - "JavaScript number variables can also have decimal points. Decimal numbers are sometimes refered to as floating point numbers or floats. ", + "We can store decimal numbers in variables too. Decimal numbers are sometimes refered to as floating point numbers or floats. ", "Note", - "Not all real numbers can be accurately represented in floating point. This can lead to rounding errors. Details Here.", + "Not all real numbers can accurately be represented in floating point. This can lead to rounding errors. Details Here.", "", "Let's create a variable myDecimal and give it a decimal value." ], From 7f6c518dd953515f46ead27b89c17eacfd4cbd8c Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 20:28:30 +0530 Subject: [PATCH 032/174] Divide one Decimal by Another with JavaScript --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 382509f55c..3dc67af850 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -509,7 +509,7 @@ "title": "Divide one Decimal by Another with JavaScript", "description": [ "Now let's divide one decimal by another.", - "Change the 0.0 so that your quotient will equal 2.2." + "Change the 0.0 so that quotient will equal to 2.2." ], "tests": [ "assert(quotient === 2.2, 'message: The variable quotient should equal 2.2.');", @@ -5369,4 +5369,4 @@ "challengeType": "0" } ] -} +} \ No newline at end of file From fc8c21cd5975f22a2e88fe69c9f13b3e317d70b6 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 24 Dec 2015 22:30:22 +0530 Subject: [PATCH 033/174] Find a Remainder with Modulus --- .../basic-javascript.json | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 3dc67af850..4641d77dc0 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -531,12 +531,12 @@ "title": "Find a Remainder with Modulus", "description": [ "The modulus operator % gives the remainder of the division of two numbers.", - "5 % 2 is 1 because", - "Math.floor(5 / 2) === 2
2 * 2 === 4
5 - 4 === 1
", + "Example
5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
", "Usage", - "Modulus can be helpful in creating alternating or cycling values. For example, in a loop an increasing variable myVar % 2 will alternate between 0 and 1 as myVar goes between even and odd numbers respectively.", + "In Maths, a number can be checked even or odd by checking the remainder of division of the number by 2. ", + "
17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)
", "

Instructions

", - "Set remainder equal to the remainder of 11 divided by 3 using the modulus operator." + "Set remainder equal to the remainder of 11 divided by 3 using the modulus operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -544,12 +544,9 @@ "assert(/\\d+\\s*%\\s*\\d+/.test(editor.getValue()), 'message: You should use the % operator');" ], "challengeSeed": [ - "var quotient = Math.floor(11 / 3);", - "", "// Only change code below this line", "", "var remainder;", - "", "" ], "tail": [ From 5360ff1654460a572d4a6e2ef7d3dba698886843 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 00:18:31 +0530 Subject: [PATCH 034/174] Assignment with Plus Equals --- .../basic-javascript.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 4641d77dc0..7150adf527 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -567,13 +567,13 @@ "id": "56533eb9ac21ba0edf2244af", "title": "Assignment with Plus Equals", "description": [ - "In Javascript it is common to need to modify the contents of a variable mathematically. Remember that everything to the right of the equals sign is evaluated first, so we can say:", + "In programming, it is common to use assignments to modify the contents of a variable. Remember that everything to the right of the equals sign is evaluated first, so we can say:", "myVar = myVar + 5;", - "to add 5 to myVar. Since this is such a common pattern, there are operators which do both a mathematical operation and assignement in one step.", + "to add 5 to myVar. Since this is such a common pattern, there are operators which do both a mathematical operation and assignment in one step.", "One such operator is the += operator.", "myVar += 5; will add 5 to myVar.", "

Instructions

", - "Convert the assignements for a, b, and c to use the += operator." + "Convert the assignments for a, b, and c to use the += operator." ], "releasedOn": "11/27/2015", "tests": [ From 87638ffd583ba69eb49ec76231b35d7081cff5c9 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 01:26:37 +0530 Subject: [PATCH 035/174] Assignment with Minus Equals --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7150adf527..8c1ace5224 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -621,10 +621,10 @@ "description": [ "Like the += operator, -= subtracts a number from a variable.", "myVar = myVar - 5;", - "Will subtract 5 from myVar. This can be rewritten as: ", + "will subtract 5 from myVar. This can be rewritten as: ", "myVar -= 5;", "

Instructions

", - "Convert the assignements for a, b, and c to use the -= operator." + "Convert the assignments for a, b, and c to use the -= operator." ], "releasedOn": "11/27/2015", "tests": [ From ffe1c1bb57059f8585df24095b12d6f2a11b1da1 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 24 Dec 2015 12:02:14 -0800 Subject: [PATCH 036/174] Complete Caesar's Cipher --- .../basic-javascript.json | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 8c1ace5224..38afae6a6b 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -4436,29 +4436,61 @@ "title": "Caesar's Cipher", "description": [ "One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount. ", - "A common modern use is a ROT13 cipher, where the values of the letters are shifted by 13 places. Thus A = N, B = O and so on.", - "Write a function which takes a ROT13 encoded array of characters as input and returns a plain text encoded array. All letters will be uppercase. Do not transform any non-alphabetic character (IE: spaces, punctiation)." + "A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.", + "Write a function which takes a ROT13 encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (IE: spaces, punctiation), but do pass them on.", + "The provided code transforms the input into an array for you, codeArr. Place the decoded values into the decodedArr array where the provided code will transform it back into a string." ], "releasedOn": "11/27/2015", "tests": [ - "assert( rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]).join(\"\") === \"FREE CODE CAMP\", 'message: rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]) should decode to [ 'F', 'R', 'E', 'E', ' ', 'C', 'O', 'D', 'E', ' ', 'C', 'A', 'M', 'P' ]');", - "assert(1===1, 'message: blah');" + "assert(rot13(\"SERR PBQR PNZC\") === \"FREE CODE CAMP\", 'message: rot13(\"SERR PBQR PNZC\") should decode to \"FREE CODE CAMP\"');", + "assert(rot13(\"SERR CVMMN!\") === \"FREE PIZZA!\", 'message: rot13(\"SERR CVMMN!\") should decode to \"FREE PIZZA!\"');", + "assert(rot13(\"SERR YBIR?\") === \"FREE LOVE?\", 'message: rot13(\"SERR YBIR?\") should decode to \"FREE LOVE?\"');", + "assert(rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") === \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\", 'message: rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") should decode to \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\"');" ], "challengeSeed": [ - "function rot13(codeArr) {", - " // Your Code Here", + "function rot13(encodedStr) {", + " var codeArr = encodedStr.split(\"\"); // String to Array", + " var decodedArr = []; // Your Result goes here", + " // Only change code below this line", "", - " return []; // Change this Line", + "", + "", + " // Only change code above this line", + " return decodedArr.join(\"\"); // Array to String", "}", "", "// Change the inputs below to test", - "rot13([ 'S', 'E', 'R', 'R', ' ', 'P', 'B', 'Q', 'R', ' ', 'P', 'N', 'Z', 'C' ]);" + "rot13(\"SERR PBQR PNZC\");" ], "tail": [ "" ], "solutions": [ - "" + "var lookup = {", + " 'A': 'N','B': 'O','C': 'P','D': 'Q',", + " 'E': 'R','F': 'S','G': 'T','H': 'U',", + " 'I': 'V','J': 'W','K': 'X','L': 'Y',", + " 'M': 'Z','N': 'A','O': 'B','P': 'C',", + " 'Q': 'D','R': 'E','S': 'F','T': 'G',", + " 'U': 'H','V': 'I','W': 'J','X': 'K',", + " 'Y': 'L','Z': 'M' ", + "};", + "", + "function rot13(encodedStr) {", + " var codeArr = encodedStr.split(\"\"); // String to Array", + " var decodedArr = []; // Your Result goes here", + " // Only change code below this line", + " ", + " decodedArr = codeArr.map(function(letter) {", + " if(lookup.hasOwnProperty(letter)) {", + " letter = lookup[letter];", + " }", + " return letter;", + " });", + "", + " // Only change code above this line", + " return decodedArr.join(\"\"); // Array to String", + "}" ], "type": "bonfire", "challengeType": "5", From 57192b4769ce7072ebd22d9b3217e8b818d6be1c Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 02:33:21 +0530 Subject: [PATCH 037/174] Assignment with Times Equals --- .../basic-javascript.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 38afae6a6b..aa711c8097 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -673,12 +673,12 @@ "id": "56533eb9ac21ba0edf2244b1", "title": "Assignment with Times Equals", "description": [ - "Yhe *= operator multiplies a variable by a number.", + "The *= operator multiplies a variable by a number.", "myVar = myVar * 5;", - "Will multiply myVar by 5. This can be rewritten as: ", + "will multiply myVar by 5. This can be rewritten as: ", "myVar *= 5;", "

Instructions

", - "Convert the assignements for a, b, and c to use the *= operator." + "Convert the assignments for a, b, and c to use the *= operator." ], "releasedOn": "11/27/2015", "tests": [ From acd3c9915032703aa3a6a600311523abd76ba5fc Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 02:57:04 +0530 Subject: [PATCH 038/174] Convert Celsius to Fahrenheit --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index aa711c8097..4e0a06ef50 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -778,7 +778,7 @@ "description": [ "To test your learning you will create a solution \"from scratch\". Place your code between the indicated lines and it will be tested against multiple test cases.", "The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.", - "You are given a variable Tc representing a temperature in Celsius. Create a variable Tf and apply the algorithm to assign it the corrasponding temperature in Fahrenheit." + "You are given a variable Tc representing a temperature in Celsius. Create a variable Tf and apply the algorithm to assign it the corresponding temperature in Fahrenheit." ], "releasedOn": "11/27/2015", "tests": [ @@ -792,7 +792,7 @@ "challengeSeed": [ "function convert(Tc) {", " // Only change code below this line", - "", + " ", "", " // Only change code above this line", " if(typeof Tf !== 'undefined') {", From a9521b2bbd9fdaf14cb619e84fd797f3ddc9da29 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 24 Dec 2015 15:31:51 -0800 Subject: [PATCH 039/174] Record Collection - Partial --- .../basic-javascript.json | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 4e0a06ef50..b7e36c6df3 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -4153,17 +4153,56 @@ }, { "id": "56533eb9ac21ba0edf2244cf", - "title": "Checkpoint: Objects", + "title": "Record Collection", "description": [ - "Update a JSON or other Object with a property name and value passed in variables" + "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unqiue id number and which has several properties. Not all albums have complete information.", + "Write a function which takes an id, a property (prop), and a value.", + "For the given id in collection:", + "If the property is \"tracks\", push the value onto the end of the tracks array.", + "If value is non-blank (value !== \"\"), then update or set the value for the prop.", + "If value is blank, delete that prop.", + "Always return the entire collection object." ], "releasedOn": "11/27/2015", "tests": [ "assert(1===1, 'message: message here');" ], "challengeSeed": [ + "var collection = {", + " 2548: {", + " album: \"Slippery When Wet\",", + " artist: \"Bon Jovi\",", + " tracks: [ ", + " \"Let It Rock\", ", + " \"You Give Love a Bad Name\" ", + " ]", + " },", + " 2468: {", + " album: \"1999\",", + " artist: \"Prince\",", + " tracks: [ ", + " \"1999\", ", + " \"Little Red Corvette\" ", + " ]", + " },", + " 1245: {", + " artist: \"Robert Palmer\",", + " tracks: [ ]", + " },", + " 5439: {", + " album: \"ABBA Gold\"", + " }", + "};", + "", + "// Only change code below this line", + "function update(id, prop, value) {", "", "", + " return collection;", + "}", + "", + "// Alter values below to test your code", + "update(5439, \"artist\", \"ABBA\");", "" ], "tail": [ From 3338991ed36b2bc2d5ea74249605a9cc194834c5 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 03:36:25 +0530 Subject: [PATCH 040/174] Declare String Variables --- .../basic-javascript.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index b7e36c6df3..7a57b06e4d 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -827,9 +827,11 @@ "id": "bd7123c9c444eddfaeb5bdef", "title": "Declare String Variables", "description": [ - "Previously we have used the code var myName = \"your name\". This is what we call a String variable. It is nothing more than a \"string\" of characters. JavaScript strings are always wrapped in quotes.", + "Previously we have used the code", + "var myName = \"your name\"", + "\"your name\" is called a string literal. It is a string because it is a series of zero or more characters enclosed in single or double quotes.", "

Instructions

", - "Create two new string variables: myFirstName and myLastName and assign them the values of your first and last name, respectively." + "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;}})(), 'message: myFirstName should be a string with at least one character in it.');", From 04c2c7980b2485c53e7324ea9adb465c443b1f94 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 03:52:26 +0530 Subject: [PATCH 041/174] Escaping Literal Quotes in Strings --- .../basic-javascript.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7a57b06e4d..3697f6e2cb 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -861,10 +861,13 @@ "id": "56533eb9ac21ba0edf2244b5", "title": "Escaping Literal Quotes in Strings", "description": [ - "When you are defining a string you must start and end with a double or single quote. What happens when you need a literal quote inside of your string?", - "In Javascript you can escape a quote inside a string by placing a backslash (\\) in front of the quote. This signals Javascript that the following quote is not the end of the string, but should instead should appear inside the string.", + "When you are defining a string you must start and end with a single or double quote. What happens when you need a literal quote: \" or ' inside of your string?", + "In JavaScript, you can escape a quote from considering it as an end of string quote by placing a backslash (\\) in front of the quote.", + "\"Alan said, \\\"Peter is learning JavaScript\\\".\"", + "This signals JavaScript that the following quote is not the end of the string, but should instead appear inside the string.", "

Instruction

", - "Use backslashes to assign the following to myStr:
\"I am a \"double quoted\" string inside \"double quotes\"\"" + "Use backslashes to assign the following to myStr variable:", + "\"I am a \"double quoted\" string inside \"double quotes\"\"" ], "releasedOn": "11/27/2015", "tests": [ From db44e2d69f4c286109011985faf5252a4230d66d Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 04:05:40 +0530 Subject: [PATCH 042/174] Quoting Strings with Single Quotes --- .../basic-javascript.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 3697f6e2cb..0555e4db32 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -893,17 +893,18 @@ "id": "56533eb9ac21ba0edf2244b4", "title": "Quoting Strings with Single Quotes", "description": [ - "Strings in Javascript may be declared with both single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in Javascript.", + "String values in JavaScript may be written with single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in Javascript.", "\"This string has \\\"double quotes\\\" in it\"", - "The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to write and to read. Instead, use single quotes:", - "'This string has \"double quotes\" in it'", + "The value in using one or the other has to do with the need to escape quotes of the same type. If you have a string with many double quotes, this can be difficult to read and write. Instead, use single quotes:", + "'This string has \"double quotes\" in it. And \"probably\" lots of them.'", "

Instructions

", "Change the provided string from double to single quotes and remove the escaping." ], "releasedOn": "11/27/2015", "tests": [ "assert(!/\\\\/g.test(editor.getValue()), 'message: Remove all the backslashes (\\)');", - "assert(editor.getValue().match(/\"/g).length === 4 && editor.getValue().match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "')" + "assert(editor.getValue().match(/\"/g).length === 4 && editor.getValue().match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "');", + "assert(myStr === 'Link', 'message: Only remove the backslashes \\ used to escape quotes.');" ], "challengeSeed": [ "var myStr = \"Link\";", From c1e3aa684e92f2bcd7645e09a54043c86555a14a Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 04:13:44 +0530 Subject: [PATCH 043/174] Escape Sequences in Strings --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0555e4db32..6fe58512ef 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -926,15 +926,15 @@ "id": "56533eb9ac21ba0edf2244b6", "title": "Escape Sequences in Strings", "description": [ - "Quotes are not the only character than can be escaped inside a string. Here is a table of common escape sequences:", + "Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:", "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", - "Note that the backslash itself must be escaped in order to display as a backslash.", + "Note that the backslash itself must be escaped in order to display as a backslash.", "

Instructions

", - "Encode the following sequence, seperated by spaces:
backslash tab tab carriage return new line and assign it to myStr" + "Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr" ], "releasedOn": "11/27/2015", "tests": [ - "assert(myStr === \"\\\\ \\t \\t \\r \\n\", 'message: myStr should have the escape sequences for backslash tab tab carriage return new line seperated by spaces');" + "assert(myStr === \"\\\\ \\t \\t \\r \\n\", 'message: myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces');" ], "challengeSeed": [ "var myStr; // Change this line", @@ -942,7 +942,7 @@ "" ], "solutions": [ - "" + "var myStr = \"\\\\ \\t \\t \\r \\n\";" ], "type": "waypoint", "challengeType": "1", From e9762cd450e5d558348ae277fb71dc42c38fa4bb Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 04:40:03 +0530 Subject: [PATCH 044/174] Concatenating Strings with Plus Operator --- .../basic-javascript.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 6fe58512ef..7f82747f4a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -954,9 +954,12 @@ }, { "id": "56533eb9ac21ba0edf2244b7", - "title": "Concatanting Strings with the Plus Operator", + "title": "Concatenating Strings with Plus Operator", "description": [ - "In Javascript the + operator for strings is called the concatanation operator. You can build strings out of other strings by concatanating them together.", + "In JavaScript, the + operator when used with a String value, it is called concatenation operator. You can build a string out of other strings by concatenating them together.", + "", + "'My name is Alan.' + ' And I am able to concatenate.'", + "", "

Instructions

", "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator.", "" From 1375391ce4c8d0cc703acb860ba90f9a194365b7 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 05:08:05 +0530 Subject: [PATCH 045/174] Concatenating Strings with the Plus Equals Operator --- .../basic-javascript.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7f82747f4a..0e874e8e61 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -992,11 +992,11 @@ }, { "id": "56533eb9ac21ba0edf2244b8", - "title": "Concatanting Strings with the Plus Equals Operator", + "title": "Concatenating Strings with the Plus Equals Operator", "description": [ - "We can also use the += operator to concatanate a string onto the end of an existing string. This can be very helpful to break a long string over several lines.", + "We can also use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.", "

Instructions

", - "Build myStr over several lines by concatenating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." + "Build myStr over several lines by concatenating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." ], "releasedOn": "11/27/2015", "tests": [ From e65b2b337159d82215935c6da54ecacdd40f91b0 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 24 Dec 2015 15:58:49 -0800 Subject: [PATCH 046/174] Fixed em tags --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0e874e8e61..c5391ba665 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -928,7 +928,7 @@ "description": [ "Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:", "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", - "Note that the backslash itself must be escaped in order to display as a backslash.", + "Note that the backslash itself must be escaped in order to display as a backslash.", "

Instructions

", "Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr" ], @@ -5446,4 +5446,4 @@ "challengeType": "0" } ] -} \ No newline at end of file +} From 758a22bb0d281d2a5ccb3afad8891380fd55c306 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 24 Dec 2015 16:00:44 -0800 Subject: [PATCH 047/174] Add table tag to exception list --- server/views/coursewares/showBonfire.jade | 2 +- server/views/coursewares/showJS.jade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/views/coursewares/showBonfire.jade b/server/views/coursewares/showBonfire.jade index ca5a901d0e..8c79d9cbbe 100644 --- a/server/views/coursewares/showBonfire.jade +++ b/server/views/coursewares/showBonfire.jade @@ -15,7 +15,7 @@ block content .col-xs-12 .bonfire-instructions for sentence in details - if (/blockquote|h4/.test(sentence)) + if (/blockquote|h4|table/.test(sentence)) !=sentence else p.wrappable.negative-10!= sentence diff --git a/server/views/coursewares/showJS.jade b/server/views/coursewares/showJS.jade index 470edd6417..62f3da8979 100644 --- a/server/views/coursewares/showJS.jade +++ b/server/views/coursewares/showJS.jade @@ -14,7 +14,7 @@ block content .col-xs-12 .bonfire-instructions for sentence in details - if (/blockquote|h4/.test(sentence)) + if (/blockquote|h4|table/.test(sentence)) !=sentence else p.wrappable.negative-10!= sentence From 5263341cc7976d10957d7e75c5518ab5fd0e3808 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 24 Dec 2015 16:32:29 -0800 Subject: [PATCH 048/174] Bonfire Record Collection Done --- .../basic-javascript.json | 62 ++++++++++++++++--- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c5391ba665..2c86b6531c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -928,7 +928,7 @@ "description": [ "Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:", "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", - "Note that the backslash itself must be escaped in order to display as a backslash.", + "Note that the backslash itself must be escaped in order to display as a backslash.", "

Instructions

", "Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr" ], @@ -4167,14 +4167,17 @@ "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unqiue id number and which has several properties. Not all albums have complete information.", "Write a function which takes an id, a property (prop), and a value.", "For the given id in collection:", - "If the property is \"tracks\", push the value onto the end of the tracks array.", "If value is non-blank (value !== \"\"), then update or set the value for the prop.", + "If the prop is \"tracks\" and value is non-blank, push the value onto the end of the tracks array.", "If value is blank, delete that prop.", "Always return the entire collection object." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "collection = collectionCopy; assert(update(5439, \"artist\", \"ABBA\")[5439][\"artist\"] === \"ABBA\", 'message: After update(5439, \"artist\", \"ABBA\"), artist should be \"ABBA\"');", + "update(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After update(2548, \"artist\", \"\"), artist should not be set');", + "assert(update(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].length === 1, 'message: After update(1245, \"tracks\", \"Addicted to Love\"), tracks should have a length of 1');", + "update(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After update(2548, \"tracks\", \"\"), tracks should not be set');" ], "challengeSeed": [ "var collection = {", @@ -4202,6 +4205,8 @@ " album: \"ABBA Gold\"", " }", "};", + "// Keep a copy of the collection for tests", + "var collectionCopy = JSON.parse(JSON.stringify(collection));", "", "// Only change code below this line", "function update(id, prop, value) {", @@ -4215,13 +4220,54 @@ "" ], "tail": [ - "" + "(function(x) { return \"collection = \\n\" + JSON.stringify(x, '\\n', 2); })(collection);" ], "solutions": [ - "" + "var collection = {", + " 2548: {", + " album: \"Slippery When Wet\",", + " artist: \"Bon Jovi\",", + " tracks: [ ", + " \"Let It Rock\", ", + " \"You Give Love a Bad Name\" ", + " ]", + " },", + " 2468: {", + " album: \"1999\",", + " artist: \"Prince\",", + " tracks: [ ", + " \"1999\", ", + " \"Little Red Corvette\" ", + " ]", + " },", + " 1245: {", + " artist: \"Robert Palmer\",", + " tracks: [ ]", + " },", + " 5439: {", + " album: \"ABBA Gold\"", + " }", + "};", + "// Keep a copy of the collection for tests", + "var collectionCopy = JSON.parse(JSON.stringify(collection));", + "", + "// Only change code below this line", + "function update(id, prop, value) {", + " if(value !== \"\") {", + " if(prop === \"tracks\") {", + " collection[id][prop].push(value);", + " } else {", + " collection[id][prop] = value;", + " }", + " } else {", + " delete collection[id][prop];", + " }", + "", + " return collection;", + "}" ], - "type": "waypoint", - "challengeType": "1", + "type": "bonfire", + "challengeType": "5", "nameCn": "", "nameFr": "", "nameRu": "", @@ -5446,4 +5492,4 @@ "challengeType": "0" } ] -} +} \ No newline at end of file From 5b9d1f2a47b2f3951b79aab3a8400ed79012de06 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 24 Dec 2015 15:58:49 -0800 Subject: [PATCH 049/174] Fixed em tags --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 2c86b6531c..379c20c864 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -928,7 +928,7 @@ "description": [ "Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:", "
CodeOutput
\\'single quote
\\\"double quote
\\\\backslash
\\nnew line
\\rcarriage return
\\ttab
\\bbackspace
\\fform feed
", - "Note that the backslash itself must be escaped in order to display as a backslash.", + "Note that the backslash itself must be escaped in order to display as a backslash.", "

Instructions

", "Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr" ], @@ -5492,4 +5492,4 @@ "challengeType": "0" } ] -} \ No newline at end of file +} From f7bf376a8d188072b9a043e068bdefd1f34d3602 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 14:04:33 +0530 Subject: [PATCH 050/174] Constructing Strings with Variables --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 379c20c864..43171e3dcc 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1030,7 +1030,7 @@ "id": "56533eb9ac21ba0edf2244b9", "title": "Constructing Strings with Variables", "description": [ - "Sometimes you will need to build a string, Mad Libs style. By using the concatanation operator (+) you can insert one or more varaibles into a string you're building.", + "Sometimes you will need to build a string, Mad Libs style. By using the concatenation operator (+), you can insert one or more variables into a string you're building.", "

Instructions

", "Set myName and build myStr with myName between the strings \"My name is \" and \" and I am swell!\"" ], From 8f52ad2eba51c7aebb8497f7ece6c0bc8233b6b8 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 15:57:42 +0530 Subject: [PATCH 051/174] Find Length of a String --- .../basic-javascript.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 43171e3dcc..f396987823 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1106,10 +1106,11 @@ }, { "id": "bd7123c9c448eddfaeb5bdef", - "title": "Check the Length Property of a String Variable", + "title": "Find Length of a String", "description": [ - "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.", + "You can find the length of a String value by writing .length after the string variable or string literal.", + "\"Alan Peter\".length; // 10", + "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.", "

Instructions

", "Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength." ], From 28b1f99deb26a03acae0c65857161c817f3047ac Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 16:16:07 +0530 Subject: [PATCH 052/174] Use Bracket Notation to Find the First Character in a String --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index f396987823..7d759f07d9 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1150,7 +1150,7 @@ "Computers don't start counting at 1 like humans do. They start at 0. This is refered to as Zero-based indexing.", "For example, the character at index 0 in the word \"Charles\" is \"C\". So if var firstName = \"Charles\", you can get the value of the first letter of the string by using firstName[0].", "

Instructions

", - "Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", + "Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", "Hint
Try looking at the firstLetterOfFirstName variable declaration if you get stuck." ], "tests": [ From 95d7c25679660fceab72355ea7a9ad22284215bb Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 16:29:13 +0530 Subject: [PATCH 053/174] Understand String Immutability --- .../basic-javascript.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7d759f07d9..d68cba9f4e 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1188,10 +1188,11 @@ "id": "56533eb9ac21ba0edf2244ba", "title": "Understand String Immutability", "description": [ - "In Javascript, strings are immutable, which means that they cannot be changed or modified once created. For example, this code:", - "var myStr = \"Bob\";
myStr[0] = \"J\";
", - "will not change the contents of myStr to \"Job\", because the contents of myStr cannot be altered. Note that this does not mean that myStr cannot be change, just that individual characters cannot be changes. The only way to change myStr would be to overwrite the contents with a new string, like this:", - "var myStr = \"Bob\";
myStr = \"Job\";
", + "In Javascript, String values are immutable, which means that they cannot be altered once created.", + "For example, the following code:", + "
var myStr = \"Bob\";
myStr[0] = \"J\";
", + "cannot change the value of myStr to \"Job\", because the contents of myStr cannot be altered. Note that this does not mean that myStr cannot be changed, just that the individual characters of a string literal cannot be changed. The only way to change myStr would be to assign it with a new string, like this:", + "
var myStr = \"Bob\";
myStr = \"Job\";
", "

Instructions

", "Correct the assignment to myStr to achieve the desired effect." ], From e5610b27796cab063a059964daaf0f7c59f40d74 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 17:03:10 +0530 Subject: [PATCH 054/174] Use Bracket Notation to Find the Nth Character in a String --- .../basic-javascript.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index d68cba9f4e..0c89d18cb9 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1230,11 +1230,11 @@ "id": "bd7123c9c450eddfaeb5bdef", "title": "Use Bracket Notation to Find the Nth Character in a String", "description": [ - "You can also use bracket notation to get the character at other positions within a string.", - "Remember that computers start counting at 0, so the first character is actually the zeroth character.", + "You can also use bracket notation to get the character at other positions within a string.", + "Remember that computers start counting at 0, so the first character is actually the zeroth character.", "

Instructions

", - "Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", - "Hint
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." + "Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", + "Hint
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');" From 96cbce7b15a1e0008cb53a41c24103c16269d01c Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 21:26:13 +0530 Subject: [PATCH 055/174] Use Bracket Notation to Find the Last Character in a String --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0c89d18cb9..8195f73072 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1269,8 +1269,8 @@ "In order to get the last letter of a string, you can subtract one from the string's length.", "For example, if var firstName = \"Charles\", you can get the value of the last letter of the string by using firstName[firstName.length - 1].", "

Instructions

", - "Use bracket notation to find the last character in the lastName variable.", - "Hint
Try looking at the lastLetterOfFirstName variable declaration if you get stuck." + "Use bracket notation to find the last character in the lastName variable.", + "Hint
Try looking at the lastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ "assert(lastLetterOfLastName === \"e\", 'message: lastLetterOfLastName should be \"e\".');", From 0676b8a82c7d7e6d4b8b3d35a59c6297fa65c1b5 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 21:31:59 +0530 Subject: [PATCH 056/174] Use Bracket Notation to Find the NthtoLast Character in a String --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 8195f73072..75ba8a9448 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1306,8 +1306,8 @@ "You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.", "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]", "

Instructions

", - "Use bracket notation to find the second-to-last character in the lastName string.", - " Hint
Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." + "Use bracket notation to find the second-to-last character in the lastName string.", + " Hint
Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ "assert(secondToLastLetterOfLastName === 'c', 'message: secondToLastLetterOfLastName should be \"c\".');", From 0ee2691e9e83d05c2f0d07f441ad6a11c3c02547 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 22:20:26 +0530 Subject: [PATCH 057/174] Word Blanks --- .../basic-javascript.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 75ba8a9448..0a01898bba 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1340,9 +1340,9 @@ "id": "56533eb9ac21ba0edf2244bb", "title": "Word Blanks", "description": [ - "We will now use our knowledge of strings to build a \"Mad Libs\" style word game we're calling \"Word Blanks\". We have provided a framework for testing your results with different words. ", + "We will now use our knowledge of strings to build a \"Mad Libs\" style word game we're calling \"Word Blanks\". We have provided a framework for testing your results with different words.", "You will need to use string operators to build a new string, result, using the provided variables: ", - "myNoun, myAdjative, myVerb, and myAdverb.", + "myNoun, myAdjective, myVerb, and myAdverb.", "The tests will run your function with several different inputs to make sure it works properly." ], "releasedOn": "11/27/2015", @@ -1353,10 +1353,10 @@ "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" ], "challengeSeed": [ - "function wordBlanks(myNoun, myAdjative, myVerb, myAdverb) {", + "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {", " var result = \"\";", " // Your code below this line", - "", + " ", "", " // Your code above this line", "\treturn result;", @@ -1370,9 +1370,9 @@ "var test2 = wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\");" ], "solutions": [ - "function wordBlanks(myNoun, myAdjative, myVerb, myAdverb) {", + "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {", " var result = \"\";", - " result = \"Once there was a \" + myNoun + \" which was very \" + myAdjative + \". \";", + " result = \"Once there was a \" + myNoun + \" which was very \" + myAdjective + \". \";", "\tresult += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";", "\treturn result;", "}" From 058c0612625e12040e688d7d517ed58953bb5cb4 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 23:46:12 +0530 Subject: [PATCH 058/174] Modify Array Data With Indexes --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0a01898bba..44b6794320 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1486,7 +1486,7 @@ "id": "cf1111c1c11feddfaeb8bdef", "title": "Modify Array Data With Indexes", "description": [ - "Unlike strings, the contents of arrays can are mutable and can be freely changed.", + "Unlike strings, the entries of arrays are mutable and can be changed freely.", "For example:", "var ourArray = [3,2,1];", "ourArray[0] = 1; // equals [1,2,1]", From 3b98f1f3390e17a827ffbcc2c1d9dc2f60e7c8fc Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Fri, 25 Dec 2015 23:59:05 +0530 Subject: [PATCH 059/174] Access Multi-Dimensional Arrays With Indexes --- .../basic-javascript.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 44b6794320..e6bece0896 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1523,12 +1523,8 @@ "id": "56592a60ddddeae28f7aa8e1", "title": "Access Multi-Dimensional Arrays With Indexes", "description": [ - "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the outer-most array, and each subsequent level of brackets refers to the next level in.", - "For example:", - "
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
", - "arr[0]; // equals [1,2,3]", - "arr[1][2]; // equals 6", - "arr[3][0][1]; // equals 11", + "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the entries in outer-most array, and each subsequent level of brackets refers to the next level of entry in.", + "Example:
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6
arr[3][0][1]; // equals 11
", "

Instructions

", "Read from myArray using bracket notation so that myData is equal to 8" ], @@ -1538,7 +1534,7 @@ ], "challengeSeed": [ "// Setup", - "var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];", + "var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];", "", "// Only change code below this line.", "var myData = myArray[0][0];", From c3e0401c5b2b783eca97e367ee0d12320e56b16f Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 00:11:21 +0530 Subject: [PATCH 060/174] Manipulate Arrays With push --- .../basic-javascript.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index e6bece0896..4a601872bd 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1554,7 +1554,8 @@ "id": "bg9995c9c69feddfaeb9bdef", "title": "Manipulate Arrays With push()", "description": [ - "An easy way to append data to the end of an array is via the push() method. push() takes a value and \"pushes\" it onto the end of the array.", + "An easy way to append data to the end of an array is via the push() function.", + ".push() takes one or more parameter and \"pushes\" it onto the end of the array.", "var arr = [1,2,3];", "arr.push(4);", "// arr is now [1,2,3,4]", @@ -1562,7 +1563,7 @@ "Push [\"dog\", 3] onto the end of the myArray variable." ], "tests": [ - "\nassert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" + "assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" ], "challengeSeed": [ "// Example", From f874feb5ea38dc171434f3536997cfcfee9a7c5d Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 01:18:31 +0530 Subject: [PATCH 061/174] Manipulate Arrays With pop --- .../basic-javascript.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 4a601872bd..7eb6dd7094 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1592,9 +1592,10 @@ "id": "bg9994c9c69feddfaeb9bdef", "title": "Manipulate Arrays With pop()", "description": [ - "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 store this \"popped off\" variable by performing pop() within a variable declaration.", - "Any type of data structure can be \"popped\" off of an array - numbers, strings, even nested arrays.", + "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 store this \"popped off\" value by assigning it to a variable.", + "Any type of entry can be \"popped\" off of an array - numbers, strings, even nested arrays.", + "For example, for the code
var oneDown = [1, 4, 6].pop();
the variable oneDown now holds the value 6 and the array becomes [1, 4].", "

Instructions

", "Use the .pop() function to remove the last item from myArray, assigning the \"popped off\" value to removedFromMyArray." ], From 53666ec9d7e83e3a1803fd7761f1b5f89b6ba2ce Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 03:01:57 +0530 Subject: [PATCH 062/174] Manipulate Arrays With unshift --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7eb6dd7094..856dc2acf8 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1669,8 +1669,8 @@ "id": "bg9997c9c69feddfaeb9bdef", "title": "Manipulate Arrays With unshift()", "description": [ - "Not only can you shift elements off of the beginning of an array, you can also unshift elements to the beginning of an array.", - "unshift() works exactly like push(), but instead of adding the element at the end of the array, unshift() adds the element at the beginning of the array.", + "Not only can you shift elements off of the beginning of an array, you can also unshift elements to the beginning of an array i.e. add elements in front of the array.", + ".unshift() works exactly like .push(), but instead of adding the element at the end of the array, unshift() adds the element at the beginning of the array.", "

Instructions

", "Add [\"Paul\",35] to the beginning of the myArray variable using unshift()." ], From 75dabcd8126f124ab96445b1bceac4e56a914318 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 03:33:06 +0530 Subject: [PATCH 063/174] Shopping List --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 856dc2acf8..4ea89e7175 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1708,7 +1708,7 @@ "title": "Shopping List", "description": [ "Create a shopping list in the variable myList. The list should be a multi-dimensional array containing several sub-arrays. ", - "The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity. IE:", + "The first element in each sub-array should contain a string with the name of the item. The second element should be a number representing the quantity i.e.", "[\"Chocolate Bar\", 15]", "There should be at least 5 sub-arrays in the list." ], From c85e9de8d0a1fd6878728a08004e752c9f9ec855 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 04:17:26 +0530 Subject: [PATCH 064/174] Write Reusable JavaScript with Functions --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 4ea89e7175..c907b21888 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1774,9 +1774,9 @@ "
function functionName() {
console.log(\"Hello World\");
}
", "You can call or invoke this function by using its name followed by parentheses, like this:", "functionName();", - "Each time the function is called it will print out the message \"Hello World\" on the dev console. All of the code between the curly braces will be executed every time the function is called.", + "Each time the function is called it will print out the message \"Hello World\" on the dev console. All of the code between the curly braces will be executed every time the function is called.", "

Instructions

", - "Create a function called myFunction which prints \"Hi World\" to the dev console. Call that function." + "
  1. Create a function called myFunction which prints \"Hi World\" to the dev console.
  2. Call the function.
" ], "tests": [ "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", From d95b0407e8f45940ade1675fd5661e66893dca35 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 04:39:13 +0530 Subject: [PATCH 065/174] Passing Values to Functions with Arguments --- .../basic-javascript.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c907b21888..c8343c5ce7 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1831,13 +1831,13 @@ "id": "56533eb9ac21ba0edf2244bd", "title": "Passing Values to Functions with Arguments", "description": [ - "Functions can take input in the form of parameters. Parameters are variables that take on the value of the arguments which are passed in to the function. Here is a function with two parameters, param1 and param2:", - "
function testFun(param1, param2) {
console.log(param1, param2);
}
", + "Functions can take input in the form of parameter. Parameters are variables that take on the value of the arguments which are passed in to the function. Here is a function with two parameters, param1 and param2:", + "
function testFun(param1, param2) {
console.log(param1, param2);
}
", "Then we can call testFun:", "testFun(\"Hello\", \"World\");", - "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFun again with different arguments and the parameters would take on the value of the new arguments.", + "We have passed two arguments, \"Hello\" and \"World\". Inside the function, param1 will equal \"Hello\" and param2 will equal \"World\". Note that you could call testFun again with different arguments and the parameters would take on the value of the new arguments.", "

Instructions

", - "Create a function called myFunction that accepts two arguments and outputs their sum to the dev console. Call your function." + "
  1. Create a function called myFunction that accepts two arguments and outputs their sum to the dev console.
  2. Call the function.
" ], "releasedOn": "11/27/2015", "tests": [ From 88288e8b9341051d449e0da33ed4fc4127f4ec8f Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 05:11:41 +0530 Subject: [PATCH 066/174] Global Scope and Functions --- .../basic-javascript.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c8343c5ce7..995b730772 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1897,8 +1897,8 @@ "id": "56533eb9ac21ba0edf2244be", "title": "Global Scope and Functions", "description": [ - "In Javascript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means the can be seen everywhere in your Javascript code. ", - "Variables which are used without the var keyword are automatically created in the global scope. This can create unintended concequences elsewhere in your code or when running a function again. You should always declare your variables with var.", + "In Javascript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means, they can be seen everywhere in your JavaScript code.", + "Variables which are used without the var keyword are automatically created in the global scope. This can create unintended consequences elsewhere in your code or when running a function again. You should always declare your variables with var.", "

Instructions

", "Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10 ", "Inside function fun1, assign 5 to oopsGlobal without using the var keyword." @@ -1933,6 +1933,7 @@ "", "function fun1() {", " // Assign 5 to oopsGlobal Here", + " ", "}", "", "// Only change code above this line", From 81e965b92a56db485104c6cbe8fa1b818abf4501 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 06:48:38 +0530 Subject: [PATCH 067/174] Local Scope and Functions --- .../basic-javascript.json | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 995b730772..ebe63ec6cf 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1969,30 +1969,47 @@ "id": "56533eb9ac21ba0edf2244bf", "title": "Local Scope and Functions", "description": [ - "Variables which are declared within a function, as well as function parameters are local. Thos means they are only visible within that function. ", + "Variables which are declared within a function, as well as the function parameters have local scope. That means, they are only visible within that function. ", "Here is a function myTest with a local variable called loc.", - "
function myTest() {
var local1 = \"foo\";
console.log(local1);
}
myTest(); // \"foo\"
console.log(local1); // \"undefined\"
", - "local1 is not defined outside of the function.", + "
function myTest() {
var loc = \"foo\";
console.log(loc);
}
myTest(); // \"foo\"
console.log(loc); // \"undefined\"
", + "loc is not defined outside of the function.", "

Instructions

", "Declare a local variable myVar inside myFunction" ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "" ], "challengeSeed": [ "function myFunction() {", " ", " console.log(myVar);", "}", + "myFunction();", "", + "// run and check the console ", + "// myVar is not defined outside of myFunction", "console.log(myVar);", + "", + "// now remove the console.log line to pass the test", "" ], "tail": [ "" ], "solutions": [ + "function myFunction() {", + " var myVar;", + " console.log(myVar);", + "}", + "myFunction();", + "", + "// run and check the console ", + "// myVar is not defined outside of myFunction", + "", + "", + "// now remove the console.log line to pass the test", + "", "" ], "type": "waypoint", From 314fc1a75a9c95890faaad9809c3a455efc86948 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 06:59:21 +0530 Subject: [PATCH 068/174] Global vs. Local Scope in Functions --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index ebe63ec6cf..2e8c897553 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2024,9 +2024,9 @@ "id": "56533eb9ac21ba0edf2244c0", "title": "Global vs. Local Scope in Functions", "description": [ - "It is possible to have both a local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.", + "It is possible to have both a local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.", "In this example:", - "
var someVar = \"Hat\";
function myFun() {
var someVar = \"Head\";
return someVar;
}
", + "
var someVar = \"Hat\";
function myFun() {
var someVar = \"Head\";
return someVar;
}
", "The function myFun will return \"Head\" because the local version of the variable is present.", "

Instructions

", "Add a local variable to myFunction to override the value of outerWear with \"sweater\"." @@ -2043,9 +2043,9 @@ "", "function myFunction() {", " // Only change code below this line", - "", - "", - "", + " ", + " ", + " ", " // Only change code above this line", " return outerWear;", "}", From 429b74029bba0142a53e029507d49fab8d978736 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 07:31:34 +0530 Subject: [PATCH 069/174] Assignment with a Returned Value --- .../basic-javascript.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 2e8c897553..60a49a4b6c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2115,12 +2115,12 @@ "id": "56533eb9ac21ba0edf2244c3", "title": "Assignment with a Returned Value", "description": [ - "If you'll recall from our discussion of Storing Values with the Equal Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.", + "If you'll recall from our discussion of Storing Values with the Equal Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.", "Assume we have pre-defined a function sum which adds two numbers together, then: ", "var ourSum = sum(5, 12);", - "will call sum, which returns a value of 17 and assigns it to ourSum.", + "will call sum function, which returns a value of 17 and assigns it to ourSum variable.", "

Instructions

", - "Call process with an argument of 7 and assign it's return valueto the variable processed." + "Call process function with an argument of 7 and assign it's return value to the variable processed." ], "releasedOn": "11/27/2015", "tests": [ @@ -2143,7 +2143,7 @@ "" ], "solutions": [ - "" + "processed = process(7);" ], "type": "waypoint", "challengeType": "1", From 93d6ff2bea3ec734e82526e65aabfe206d24c608 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 08:06:56 +0530 Subject: [PATCH 070/174] Stand in Line --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 60a49a4b6c..f5632a19dc 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2157,8 +2157,8 @@ "id": "56533eb9ac21ba0edf2244c6", "title": "Stand in Line", "description": [ - "In Computer Science a queue is an abastract datatype where items are kept in order. New items can be added to the back of the queue and old items are taken off the front of the queue.", - "Write a function queue which takes an array and an item as arguments. Add the item onto the end of the array, then remove and return the item at the front of the queue." + "In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.", + "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove and return the item at the front of the queue." ], "releasedOn": "11/27/2015", "tests": [ From cba48287ffd8ffae51ddc43f51df036d04201d5b Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 08:45:33 +0530 Subject: [PATCH 071/174] Use Conditional Logic with If Statements --- .../basic-javascript.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index f5632a19dc..b286b97af3 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2223,12 +2223,12 @@ "title": "Use Conditional Logic with If Statements", "description": [ "We can use if statements in JavaScript to only execute code if a certain condition is met.", - "if statements require a boolean condition to evaluate. If the boolean evaluates to true, the statement inside the curly braces executes. If it evaluates to false, the code will not execute.", + "if statements require a boolean condition to evaluate. If the boolean evaluates to true, the statement inside the curly braces executes. If it evaluates to false, the code will not execute.", "For example:", - "
function test(myVal) {
if (myVal > 10) {
return \"Greater Than\";
}
return \"Not Greater Than\";
}
", - "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", + "
function test(myVal) {
if (myVal > 10) {
return \"Greater Than\";
}
return \"Not Greater Than\";
}
", + "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", "

Instructions

", - "Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than 5." + "Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than or equal to 5." ], "tests": [ "assert(typeof myFunction === \"function\", 'message: myFunction should be a function');", @@ -2251,9 +2251,9 @@ "function myFunction(testMe) {", "", " // Only change code below this line.", - "", - "", - "", + " ", + " ", + " ", " // Only change code above this line.", "", "}", From f9256aa49593bb856276a9edd716722b1306ddaf Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 09:24:16 +0530 Subject: [PATCH 072/174] Comparison with the Equality Operator --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index b286b97af3..239ff2a1be 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2276,14 +2276,14 @@ "id": "56533eb9ac21ba0edf2244d0", "title": "Comparison with the Equality Operator", "description": [ - "There are many Comparison Operators in Javascript. All of these operators return a boolean true or false value.", - "The most basic operators is the equality operator ==. The equality operator compares to values and returns true if they're equivilent or false if they are not. Note that equality is different from assignement (=), which returns the value to the right of the operator.", - "
function equalityTest(myVal) {
if (myVal == 10) {
return \"Equal\";
}
return \"Not Equal\";
}
", + "There are many Comparison Operators in JavaScript. All of these operators return a boolean true or false value.", + "The most basic operator is the equality operator ==. The equality operator compares two values and returns true if they're equivalent or false if they are not. Note that equality is different from assignment (=), which assigns the value at the right of the operator to a variable in the left.", + "
function equalityTest(myVal) {
if (myVal == 10) {
return \"Equal\";
}
return \"Not Equal\";
}
", "If myVal is equal to 10, the function will return \"Equal\". If it is not, the function will return \"Not Equal\".", "The equality operator will do it's best to convert values for comparison, for example:", - "
1 == 1 // true
\"1\" == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
0 == undefined // false
null == undefined // true
", + "
1 == 1 // true
\"1\" == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
0 == undefined // false
null == undefined // true
", "

Instructions

", - "Add the equality operator to the indicated line so the function will return \"Equal\" when val is equivilent to 12" + "Add the equality operator to the indicated line so that the function will return \"Equal\" when val is equivalent to 12" ], "releasedOn": "11/27/2015", "tests": [ From 9157f1992f3091b7da2c179eca8b12812c3519a2 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 09:55:36 +0530 Subject: [PATCH 073/174] Comparison with the Strict Equality Operator --- .../basic-javascript.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 239ff2a1be..cc3d9a553a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2326,8 +2326,9 @@ "description": [ "Strict equality (===) is the counterpart to the equality operator (==). Unlike the equality operator, strict equality tests both the type and value of the compared elements.", "Examples
3 === 3 // true
3 === '3' // false
", + "In the second example, 3 is a Number type and '3' is a String type.", "

Instructions

", - "Change the equality operator to a strict equality on the if statement so the function will return \"Equal\" when val is strictltly equal to 7" + "Use strict equality operator in if statement so the function will return \"Equal\" when val is strictly equal to 7" ], "releasedOn": "11/27/2015", "tests": [ From 06bc6f75a0de3e4db3d1e59c4efa309f8f63259e Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 17:45:59 +0530 Subject: [PATCH 074/174] Comparison with the Inequality Operator --- .../basic-javascript.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index cc3d9a553a..a0019b271f 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2369,10 +2369,10 @@ "id": "56533eb9ac21ba0edf2244d2", "title": "Comparison with the Inequality Operator", "description": [ - "The inequality operator (!=) is the opposite of the equality operator. It means \"Not Equal\" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert types.", - "Examples
1 != 2 // true
1 != \"1\" // false
1 != '1' // false
1 != true // false
0 != false // false
", + "The inequality operator (!=) is the opposite of the equality operator. It means \"Not Equal\" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing.", + "Examples
1 != 2 // true
1 != \"1\" // false
1 != '1' // false
1 != true // false
0 != false // false
", "

Instructions

", - "Add the inequality operator != to the if statement so the function will return \"Not Equal\" when val is not equivilent to 99" + "Add the inequality operator != in the if statement so that the function will return \"Not Equal\" when val is not equivalent to 99" ], "releasedOn": "11/27/2015", "tests": [ From aeb12fd4c462f30411719007fc517b47ee0391d8 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 17:51:46 +0530 Subject: [PATCH 075/174] Comparison with the Strict Inequality Operator --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index a0019b271f..8125da7ed9 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2415,8 +2415,8 @@ "id": "56533eb9ac21ba0edf2244d3", "title": "Comparison with the Strict Inequality Operator", "description": [ - "The inequality operator (!==) is the opposite of the strict equality operator. It means \"Strictly Not Equal\" and returns false where strict equality would return true and vice versa. Strict inequality will not convert types.", - "Examples
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
", + "The inequality operator (!==) is the opposite of the strict equality operator. It means \"Strictly Not Equal\" and returns false where strict equality would return true and vice versa. Strict inequality will not convert data types.", + "Examples
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
", "

Instructions

", "Add the strict inequality operator to the if statement so the function will return \"Not Equal\" when val is not strictly equal to 17" ], From 8621136b586adcdca513786adb5bc8f67a267461 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 18:01:09 +0530 Subject: [PATCH 076/174] Comparison with the Greater Than Operator --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 8125da7ed9..163190b523 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2465,8 +2465,8 @@ "id": "56533eb9ac21ba0edf2244d4", "title": "Comparison with the Greater Than Operator", "description": [ - "The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. If the number on the left is less than or equal to the number on the right, it returns false. Like the equality operator, greater than converts data types.", - "Examples
5 > 3 // true
7 > '3' // true
2 > 3 // false
'1' > 9 // false
", + "The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. Otherwise, it returns false.
Like the equality operator, greater than operator will convert data types of values while comparing.", + "Examples
5 > 3 // true
7 > '3' // true
2 > 3 // false
'1' > 9 // false
", "

Instructions

", "Add the greater than operator to the indicated lines so that the return statements make sense." ], From b1c7b9097fd62a3652a8a4ee447ba80d1e4a1562 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 18:49:52 +0530 Subject: [PATCH 077/174] Comparison with the Greater Than Equal To Operator --- .../basic-javascript.json | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 163190b523..073de8e211 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2519,8 +2519,8 @@ "id": "56533eb9ac21ba0edf2244d5", "title": "Comparison with the Greater Than Equal To Operator", "description": [ - "The greater than equal to operator (>=) compares the values of two numbers. If the number to the left is greater than or equal the number to the right, it returns true. If the number on the left is less than the number on the right, it returns false. Like the equality operator, greater than equal to converts data types.", - "Examples
6 >= 6 // true
7 >= '3' // true
2 >= 3 // false
'7' >= 9 // false
", + "The greater than equal to operator (>=) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns true. Otherwise, it returns false.
Like the equality operator, greater than equal to operator will convert data types while comparing.", + "Examples
6 >= 6 // true
7 >= '3' // true
2 >= 3 // false
'7' >= 9 // false
", "

Instructions

", "Add the greater than equal to operator to the indicated lines so that the return statements make sense." ], @@ -2552,7 +2552,17 @@ "myTest(10);" ], "solutions": [ - "" + "function myTest(val) {", + " if (val >= 20) { // Change this line", + " return \"20 or Over\";", + " }", + " ", + " if (val >= 10) { // Change this line", + " return \"10 or Over\";", + " }", + "", + " return \"9 or Under\";", + "}" ], "type": "waypoint", "challengeType": "1", From 307e43e2ad01f1c282bcb31822172a13672c3193 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 19:12:10 +0530 Subject: [PATCH 078/174] Comparison with the Less Than Operator --- .../basic-javascript.json | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 073de8e211..4622387f21 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2576,8 +2576,8 @@ "id": "56533eb9ac21ba0edf2244d6", "title": "Comparison with the Less Than Operator", "description": [ - "The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. If the number on the left is greater than or equal to the number on the right, it returns false. Like the equality operator, less than converts data types.", - "Examples
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
", + "The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. Otherwise, it returns false. Like the equality operator, less than operator converts data types while comparing.", + "Examples
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
", "

Instructions

", "Add the less than operator to the indicated lines so that the return statements make sense." ], @@ -2608,7 +2608,17 @@ "myTest(10);" ], "solutions": [ - "" + "function myTest(val) {", + " if (val < 25) { // Change this line", + " return \"Under 25\";", + " }", + " ", + " if (val < 55) { // Change this line", + " return \"Under 55\";", + " }", + "", + " return \"55 or Over\";", + "}" ], "type": "waypoint", "challengeType": "1", From b3ac3cf09ba86aee2192a9413d99fc6ea51b1832 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 20:51:20 +0530 Subject: [PATCH 079/174] Comparison with the Less Than Equal To Operator --- .../basic-javascript.json | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 4622387f21..1067f053a3 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2633,28 +2633,29 @@ "title": "Comparison with the Less Than Equal To Operator", "description": [ "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equl the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", - "Examples
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", + "Examples
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", "

Instructions

", "Add the less than equal to operator to the indicated lines so that the return statements make sense." ], "releasedOn": "11/27/2015", "tests": [ - "assert(myTest(0) === \"Smaller Than 12\", 'message: myTest(0) should return \"Smaller Than 12\"');", - "assert(myTest(11) === \"Smaller Than 12\", 'message: myTest(11) should return \"Smaller Than 12\"');", - "assert(myTest(12) === \"Smaller Than 24\", 'message: myTest(12) should return \"Smaller Than 24\"');", - "assert(myTest(23) === \"Smaller Than 24\", 'message: myTest(23) should return \"Smaller Than 24\"');", - "assert(myTest(24) === \"25 or More\", 'message: myTest(24) should return \"24 or More\"');", - "assert(myTest(55) === \"25 or More\", 'message: myTest(55) should return \"24 or More\"');", + "assert(myTest(0) === \"Smaller Than or Equal to 12\", 'message: myTest(0) should return \"Smaller Than or Equal to 12\"');", + "assert(myTest(11) === \"Smaller Than or Equal to 12\", 'message: myTest(11) should return \"Smaller Than or Equal to 12\"');", + "assert(myTest(12) === \"Smaller Than or Equal to 12\", 'message: myTest(12) should return \"Smaller Than or Equal to 12\"');", + "assert(myTest(23) === \"Smaller Than or Equal to 24\", 'message: myTest(23) should return \"Smaller Than or Equal to 24\"');", + "assert(myTest(24) === \"Smaller Than or Equal to 24\", 'message: myTest(24) should return \"Smaller Than or Equal to 24\"');", + "assert(myTest(25) === \"25 or More\", 'message: myTest(25) should return \"25 or More\"');", + "assert(myTest(55) === \"25 or More\", 'message: myTest(55) should return \"25 or More\"');", "assert(editor.getValue().match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <= operator at least twice');" ], "challengeSeed": [ "function myTest(val) {", " if (val) { // Change this line", - " return \"Smaller Than 12\";", + " return \"Smaller Than or Equal to 12\";", " }", " ", " if (val) { // Change this line", - " return \"Smaller Than 24\";", + " return \"Smaller Than or Equal to 24\";", " }", "", " return \"25 or More\";", @@ -2665,7 +2666,17 @@ "" ], "solutions": [ - "" + "function myTest(val) {", + " if (val <= 12) { // Change this line", + " return \"Smaller Than or Equal to 12\";", + " }", + " ", + " if (val <= 24) { // Change this line", + " return \"Smaller Than or Equal to 24\";", + " }", + "", + " return \"25 or More\";", + "}" ], "type": "waypoint", "challengeType": "1", From 61cafd376c684598c2768cbdab236e707f63de48 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 21:26:59 +0530 Subject: [PATCH 080/174] Comparisons with the Logical And Operator --- .../basic-javascript.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 1067f053a3..41fcec2160 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2692,9 +2692,11 @@ "description": [ "Sometimes you will need to test more than one thing at a time. The logical and operator (&&) returns true if and only if the operands to the left and right of it are true.", "The same effect could be achieved by nesting an if statement inside another if:", - "
if (num < 10) {
if (num > 5) {
return \"Yes\";
}
}
return \"No\";
Will only return \"Yes\" if num is between 6 and 9. The same logic can be written as:
if (num < 10 && num > 5) {
return \"Yes\";
}
return \"No\";
", + "
if (num > 5) {
if (num < 10) {
return \"Yes\";
}
}
return \"No\";
", + "will only return \"Yes\" if num is between 6 and 9 (6 and 9 included). The same logic can be written as:", + "
if (num > 5 && num < 10) {
return \"Yes\";
}
return \"No\";
", "

Instructions

", - "Combine the two if statements into one statement which returns \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, return \"No\"." + "Combine the two if statements into one statement which will return \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, will return \"No\"." ], "releasedOn": "11/27/2015", "tests": [ From c99c12068a48966b42cfe30518dd4d158b4dddb7 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 21:40:52 +0530 Subject: [PATCH 081/174] Comparisons with the Logical Or Operator --- .../basic-javascript.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 41fcec2160..ea7a6b36f5 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2748,11 +2748,13 @@ "id": "56533eb9ac21ba0edf2244d9", "title": "Comparisons with the Logical Or Operator", "description": [ - "The logical or operator (||) returns true if either ofoperands is true, or false if neither is true.", + "The logical or operator (||) returns true if either ofoperands is true. Otherwise, it returns false.", "The pattern below should look familiar from prior waypoints:", - "
if (num > 10) {
return \"No\";
}
if (num < 5) {
return \"No\";
}
return \"Yes\";
Will only return \"Yes\" if num is between 5 and 10. The same logic can be written as:
if (num > 10 || num < 5) {
return \"No\";
}
return \"Yes\";
", + "
if (num > 10) {
return \"No\";
}
if (num < 5) {
return \"No\";
}
return \"Yes\";
", + "will return \"Yes\" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:", + "
if (num > 10 || num < 5) {
return \"No\";
}
return \"Yes\";
", "

Instructions

", - "Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." + "Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." ], "releasedOn": "11/27/2015", "tests": [ From bfa86770ba52dc5fd7fc7ae01be55296569ffdfa Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 22:43:55 +0530 Subject: [PATCH 082/174] Golf Code --- .../basic-javascript.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index ea7a6b36f5..cf8f6994cd 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2808,8 +2808,8 @@ "id": "5664820f61c48e80c9fa476c", "title": "Golf Code", "description": [ - "In the game of golf each hole has a par for the average number of strokes needed to sink the ball. Depending on how far above or below par your stokes are, there is a different nickname.", - "Your function will be passed a par and strokes. Return strings according to this table:", + "In the game of golf each hole has a par for the average number of strokes needed to sink the ball. Depending on how far above or below par your stokes are, there is a different nickname.", + "Your function will be passed a par and strokes. Return strings according to this table (based on order of priority - top (highest) to bottom (lowest)):", "
StokesReturn
1\"Hole-in-one!\"
<= par - 2\"Eagle\"
par - 1\"Birdie\"
par\"Par\"
par + 1\"Bogey\"
par + 2\"Double Bogey\"
>= par + 3\"Go Home!\"
", "par and strokes will always be numeric and positive." ], @@ -2820,6 +2820,7 @@ "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", + "assert(golfScore(1, 1) === \"Hole-in-one!\", 'message: golfScore(1, 1) should return \"Hole-in-one!\"');", "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", @@ -2829,7 +2830,7 @@ "challengeSeed": [ "function golfScore(par, strokes) {", " // Only change code below this line", - "", + " ", " ", " return \"Change Me\";", " // Only change code above this line", From 33094f2dec7c22f2780634c777e2c6effe2a83cc Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sat, 26 Dec 2015 23:34:57 +0530 Subject: [PATCH 083/174] Introducing Else If Statements --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index cf8f6994cd..ff54dca951 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2939,8 +2939,8 @@ "id": "56533eb9ac21ba0edf2244db", "title": "Introducing Else If Statements", "description": [ - "If you have multiple conditions that need to be met, you can chain if statements together with else if statements.", - "
if (num > 15) {
return \"Bigger then 15\";
} else if (num < 5) {
return \"Smaller than 5\";
} else {
return \"Between 5 and 15\";
}
", + "If you have multiple conditions that need to be addressed, you can chain if statements together with else if statements.", + "
if (num > 15) {
return \"Bigger then 15\";
} else if (num < 5) {
return \"Smaller than 5\";
} else {
return \"Between 5 and 15\";
}
", "

Instructions

Convert the logic to use else if statements." ], "releasedOn": "11/27/2015", From ffcc7d32bac53d9620ab63812f1b9f2c3bc956ee Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 01:04:23 +0530 Subject: [PATCH 084/174] Chaining If/Else Statements --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index ff54dca951..aca8fc8c43 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2993,11 +2993,11 @@ "id": "56533eb9ac21ba0edf2244dc", "title": "Chaining If/Else Statements", "description": [ - "if...else if statements can be chained together for complex logic. Here is pseudocode of multiple chained if/else if statements:", - "
if(condition1) {
statement1
} else if (condition1) {
statement1
} else if (condition3) {
statement3
. . .
} else {
statementN
}
", + "if...else statements can be chained together for complex logic. Here is pseudocode of multiple chained if / else if statements:", + "
if(condition1) {
statement1
} else if (condition1) {
statement1
} else if (condition3) {
statement3
. . .
} else {
statementN
}
", "

Instructions

", "Write chained if/else if statements to fulfill the following conditions:", - "num < 5 - return \"Tiny\"
num < 10 - return \"Small\"
num < 15 - return \"Medium\"
num < 20 - return \"Large\"
num >= 20 - return \"Huge\"" + "num < 5 - return \"Tiny\"
num < 10 - return \"Small\"
num < 15 - return \"Medium\"
num < 20 - return \"Large\"
num >= 20 - return \"Huge\"" ], "releasedOn": "11/27/2015", "tests": [ @@ -3018,8 +3018,8 @@ "challengeSeed": [ "function myTest(num) {", " // Only change code below this line", - "", - "", + " ", + " ", " return \"Change Me\";", " // Only change code above this line", "}", From 50cbe694bbd65ec06b884cd081bd5f22ccde2113 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 01:41:36 +0530 Subject: [PATCH 085/174] Selecting from many options with Switch Statements --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index aca8fc8c43..294391a11a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3054,11 +3054,11 @@ "id": "56533eb9ac21ba0edf2244dd", "title": "Selecting from many options with Switch Statements", "description": [ - "If you have many options to choose from use a switch statement A switch statement tests a value and has many case statements which define that value can be, shown here in pseudocode:", - "
switch (num) {
case value1:
statement1
break;
value2:
statement2;
break;
...
valueN:
statementN;
}
", - "case values are tested with strict equality (===). The break tells Javascript to stop executing statements. If the break is omitted, the next statement will be executed.", + "If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which defines various possible values. Statements are executed from the first matched case value unless a break is encountered. Shown here in pseudocode:", + "
switch (num) {
case value1:
statement1;
break;
case value2:
statement2;
break;
...
case valueN:
statementN;
break;
}
", + "case values are tested with strict equality (===). The break tells JavaScript to stop executing statements. If the break is omitted, the next statement will be executed.", "

Instructions

", - "Write a switch statement to set answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" + "Write a switch statement to set answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" ], "releasedOn": "11/27/2015", "tests": [ @@ -3075,7 +3075,7 @@ " // Only change code below this line", " ", " ", - "", + " ", " // Only change code above this line ", " return answer; ", "}", From 7e97016b4193236e2cf9a7fb284c7b25a3dcc602 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 01:55:58 +0530 Subject: [PATCH 086/174] Adding a default option in Switch statements --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 294391a11a..11bece8a92 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3116,11 +3116,11 @@ "id": "56533eb9ac21ba0edf2244de", "title": "Adding a default option in Switch statements", "description": [ - "In a switch statement you may not be able to specify all possible values as case statements. Instead, you can use the default statement where a case would go. Think of it like an else statement for switch.", - "A default statement should be the last \"case\" in the list.", - "
switch (num) {
case value1:
statement1
break;
value2:
statement2;
break;
...
default:
defaultStatement;
}
", + "In a switch statement you may not be able to specify all possible values as case statements. Instead, you can add the default statement which will be executed if no matching case are found. Think of it like the final else statement in an if...else chain.", + "A default statement should be the last case.", + "
switch (num) {
case value1:
statement1
break;
case value2:
statement2;
break;
...
default:
defaultStatement;
}
", "

Instructions

", - "Write a switch statement to set answer for the following conditions:
\"a\" - \"apple\"
\"b\" - \"bird\"
\"c\" - \"cat\"
default - \"stuff\"" + "Write a switch statement to set answer for the following conditions:
\"a\" - \"apple\"
\"b\" - \"bird\"
\"c\" - \"cat\"
default - \"stuff\"" ], "releasedOn": "11/27/2015", "tests": [ @@ -3138,7 +3138,7 @@ " // Only change code below this line", " ", " ", - "", + " ", " // Only change code above this line ", " return answer; ", "}", From 56d33fedc5941266b72dace51076271e7a973ab6 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 02:13:45 +0530 Subject: [PATCH 087/174] Multiple Identical Options in Switch Statements --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 11bece8a92..e11da307ca 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3179,7 +3179,7 @@ "id": "56533eb9ac21ba0edf2244df", "title": "Multiple Identical Options in Switch Statements", "description": [ - "If the break statement is ommitted from a switch statement case, the following case statement(s). If you have mutiple inputs with the same output, you can represent them in a switch statement like this:", + "If the break statement is ommitted from a switch statement case, the following case statement(s) are executed unless a break is encountered. If you have mutiple inputs with the same output, you can represent them in a switch statement like this:", "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", "Cases for 1, 2, and 3 will all produce the same result.", "

Instructions

", @@ -3206,7 +3206,7 @@ " // Only change code below this line", " ", " ", - "", + " ", " // Only change code above this line ", " return answer; ", "}", From 7e5305de694dceda5ae739242e186da58a06f55e Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 02:28:55 +0530 Subject: [PATCH 088/174] Replacing If/Else chains with Switch --- .../basic-javascript.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index e11da307ca..a6d4405b1c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3252,9 +3252,9 @@ "title": "Replacing If/Else chains with Switch", "description": [ "If you have many options to choose from, a switch statement can be easier to write than many chained if/if else statements. The following:", - "
if(val === 1) {
answer = \"a\";
} else if(val === 2) {
answer = \"b\";
} else {
answer = \"c\";
}
", + "
if(val === 1) {
answer = \"a\";
} else if(val === 2) {
answer = \"b\";
} else {
answer = \"c\";
}
", "can be replaced with:", - "
switch (val) {
case 1:
answer = \"a\";
break;
case 2:
answer = \"b\";
break;
default:
answer = \"c\";
}
", + "
switch (val) {
case 1:
answer = \"a\";
break;
case 2:
answer = \"b\";
break;
default:
answer = \"c\";
}
", "

Instructions

", "Change the chained if/if else statements into a switch statement." ], @@ -3267,7 +3267,9 @@ "assert(myTest(42) === \"The Answer\", 'message: myTest(42) should be \"The Answer\"');", "assert(myTest(1) === \"There is no #1\", 'message: myTest(1) should be \"There is no #1\"');", "assert(myTest(99) === \"Missed me by this much!\", 'message: myTest(99) should be \"Missed me by this much!\"');", - "assert(myTest(7) === \"Ate Nine\", 'message: myTest(7) should be \"Ate Nine\"');" + "assert(myTest(7) === \"Ate Nine\", 'message: myTest(7) should be \"Ate Nine\"');", + "assert(myTest(\"John\") === \"\", 'message: myTest(\"John\") should be \"\" (empty string)');", + "assert(myTest(156) === \"\", 'message: myTest(156) should be \"\" (empty string)');" ], "challengeSeed": [ "function myTest(val) {", @@ -3285,7 +3287,7 @@ " } else if(val === 7) {", " answer = \"Ate Nine\";", " }", - "", + " ", " // Only change code above this line ", " return answer; ", "}", From a7a312829aa4a85ed690971b354f5009741a1580 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Sat, 26 Dec 2015 23:30:01 -0800 Subject: [PATCH 089/174] Fix brs, other fixes --- .../basic-javascript.json | 249 ++++++++++-------- 1 file changed, 136 insertions(+), 113 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index a6d4405b1c..f22792c3a7 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -222,7 +222,8 @@ "MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly reccomended that for sake of clarity you do not use this language feature.", "

Best Practice

Write variable names in Javascript in camelCase. In camelCase, variable names made of multiple words have the first word in all lowercase and the first letter of each subsequent word(s) capitalized.
", " ", - "Examples:
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", + "Examples:", + "
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", "

Instructions

", "Correct the variable assignements so their names match their variable declarations above." ], @@ -270,7 +271,8 @@ "Now let's try to add two numbers using JavaScript.", "JavaScript uses the + symbol as addition operation when placed between two numbers.", "", - "Example
5 + 10 = 15
", + "Example", + "
5 + 10 = 15
", "", "

Instructions

", "Change the 0 so that sum will equal 20." @@ -296,7 +298,8 @@ "We can also subtract one number from another.", "JavaScript uses the - symbol for subtraction.", "", - "Example
12 - 6 = 6
", + "Example", + "
12 - 6 = 6
", "", "

Instructions

", "Change the 0 so that difference will equal 12." @@ -326,7 +329,8 @@ "We can also multiply one number by another.", "JavaScript uses the * symbol for multiplication of two numbers.", "", - "Example
13 * 13 = 169
", + "Example", + "
13 * 13 = 169
", "", "

Instructions

", "Change the 0 so that product will equal 80." @@ -356,7 +360,8 @@ "We can also divide one number by another.", "JavaScript uses the / symbol for division.", "", - "Example
16 / 2 = 8
", + "Example", + "
16 / 2 = 8
", "", "

Instructions

", "Change the 0 so that quotient will equal to 2." @@ -531,7 +536,8 @@ "title": "Find a Remainder with Modulus", "description": [ "The modulus operator % gives the remainder of the division of two numbers.", - "Example
5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
", + "Example", + "
5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
", "Usage", "In Maths, a number can be checked even or odd by checking the remainder of division of the number by 2. ", "
17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)
", @@ -1151,7 +1157,8 @@ "For example, the character at index 0 in the word \"Charles\" is \"C\". So if var firstName = \"Charles\", you can get the value of the first letter of the string by using firstName[0].", "

Instructions

", "Use bracket notation to find the first character in the lastName variable and assign it to firstLetterOfLastName.", - "Hint
Try looking at the firstLetterOfFirstName variable declaration if you get stuck." + "Hint", + "
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;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" @@ -1234,7 +1241,8 @@ "Remember that computers start counting at 0, so the first character is actually the zeroth character.", "

Instructions

", "Let's try to set thirdLetterOfLastName to equal the third letter of the lastName variable.", - "Hint
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." + "Hint", + "
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], "tests": [ "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');" @@ -1270,7 +1278,8 @@ "For example, if var firstName = \"Charles\", you can get the value of the last letter of the string by using firstName[firstName.length - 1].", "

Instructions

", "Use bracket notation to find the last character in the lastName variable.", - "Hint
Try looking at the lastLetterOfFirstName variable declaration if you get stuck." + "Hint", + "
Try looking at the lastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ "assert(lastLetterOfLastName === \"e\", 'message: lastLetterOfLastName should be \"e\".');", @@ -1307,7 +1316,8 @@ "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]", "

Instructions

", "Use bracket notation to find the second-to-last character in the lastName string.", - " Hint
Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." + " Hint", + "
Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." ], "tests": [ "assert(secondToLastLetterOfLastName === 'c', 'message: secondToLastLetterOfLastName should be \"c\".');", @@ -1390,10 +1400,11 @@ "title": "Store Multiple Values in one Variable using JavaScript Arrays", "description": [ "With JavaScript array variables, we can store several pieces of data in one place.", - "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\"].", + "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\"].", "

Instructions

", "Create a new array called myArray that contains both a string and a number (in that order).", - "Hint
Refer to the example code in the text editor if you get stuck." + "Hint", + "
Refer to the example code in the text editor if you get stuck." ], "tests": [ "assert(typeof(myArray) == 'object', 'message: myArray should be an array.');", @@ -1450,11 +1461,9 @@ "title": "Access Array Data with Indexes", "description": [ "We can access the data inside arrays using indexes.", - "Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array is element 0", - "For example:", - "var array = [1,2,3];", - "array[0]; //equals 1", - "var data = array[1];", + "Array indexes are written in the same bracket notation that strings use, except that instead of specifying a character, they are specifying an entry in the array. Like strings, arrays use zero-based indexing, so the first element in an array is element 0.", + "Example", + "
var array = [1,2,3];
array[0]; // equals 1
var data = array[1]; // equals 2
", "

Instructions

", "Create a variable called myData and set it to equal the first value of myArray." ], @@ -1487,9 +1496,8 @@ "title": "Modify Array Data With Indexes", "description": [ "Unlike strings, the entries of arrays are mutable and can be changed freely.", - "For example:", - "var ourArray = [3,2,1];", - "ourArray[0] = 1; // equals [1,2,1]", + "Example", + "
var ourArray = [3,2,1];
ourArray[0] = 1; // equals [1,2,1]
", "

Instructions

", "Modify the data stored at index 0 of myArray to a value of 3." ], @@ -1524,7 +1532,8 @@ "title": "Access Multi-Dimensional Arrays With Indexes", "description": [ "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the entries in outer-most array, and each subsequent level of brackets refers to the next level of entry in.", - "Example:
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6
arr[3][0][1]; // equals 11
", + "Example", + "
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6
arr[3][0][1]; // equals 11
", "

Instructions

", "Read from myArray using bracket notation so that myData is equal to 8" ], @@ -1771,7 +1780,7 @@ "description": [ "In JavaScript, we can divide up our code into reusable parts called functions.", "Here's an example of a function:", - "
function functionName() {
console.log(\"Hello World\");
}
", + "
function functionName() {
console.log(\"Hello World\");
}
", "You can call or invoke this function by using its name followed by parentheses, like this:", "functionName();", "Each time the function is called it will print out the message \"Hello World\" on the dev console. All of the code between the curly braces will be executed every time the function is called.", @@ -2026,7 +2035,7 @@ "description": [ "It is possible to have both a local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.", "In this example:", - "
var someVar = \"Hat\";
function myFun() {
var someVar = \"Head\";
return someVar;
}
", + "
var someVar = \"Hat\";
function myFun() {
var someVar = \"Head\";
return someVar;
}
", "The function myFun will return \"Head\" because the local version of the variable is present.", "

Instructions

", "Add a local variable to myFunction to override the value of outerWear with \"sweater\"." @@ -2072,8 +2081,8 @@ "title": "Return a Value from a Function with Return", "description": [ "We can pass values into a function with arguments. You can use a return statement to send a value back out of a function.", - "For Example:", - "
function plusThree(num) {
return num + 3;
}
var answer = plusThree(5); // 8
", + "Example", + "
function plusThree(num) {
return num + 3;
}
var answer = plusThree(5); // 8
", "plusThree takes an argument for num and returns a value equal to num + 3.", "

Instructions

", "Create a function timesFive that accepts one argument, multiplies it by 5, and returns the new value." @@ -2224,7 +2233,7 @@ "description": [ "We can use if statements in JavaScript to only execute code if a certain condition is met.", "if statements require a boolean condition to evaluate. If the boolean evaluates to true, the statement inside the curly braces executes. If it evaluates to false, the code will not execute.", - "For example:", + "Example", "
function test(myVal) {
if (myVal > 10) {
return \"Greater Than\";
}
return \"Not Greater Than\";
}
", "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", "

Instructions

", @@ -2325,7 +2334,8 @@ "title": "Comparison with the Strict Equality Operator", "description": [ "Strict equality (===) is the counterpart to the equality operator (==). Unlike the equality operator, strict equality tests both the type and value of the compared elements.", - "Examples
3 === 3 // true
3 === '3' // false
", + "Examples", + "
3 === 3 // true
3 === '3' // false
", "In the second example, 3 is a Number type and '3' is a String type.", "

Instructions

", "Use strict equality operator in if statement so the function will return \"Equal\" when val is strictly equal to 7" @@ -2370,7 +2380,8 @@ "title": "Comparison with the Inequality Operator", "description": [ "The inequality operator (!=) is the opposite of the equality operator. It means \"Not Equal\" and returns false where equality would return true and vice versa. Like the equality operator, the inequality operator will convert data types of values while comparing.", - "Examples
1 != 2 // true
1 != \"1\" // false
1 != '1' // false
1 != true // false
0 != false // false
", + "Examples", + "
1 != 2 // true
1 != \"1\" // false
1 != '1' // false
1 != true // false
0 != false // false
", "

Instructions

", "Add the inequality operator != in the if statement so that the function will return \"Not Equal\" when val is not equivalent to 99" ], @@ -2416,7 +2427,8 @@ "title": "Comparison with the Strict Inequality Operator", "description": [ "The inequality operator (!==) is the opposite of the strict equality operator. It means \"Strictly Not Equal\" and returns false where strict equality would return true and vice versa. Strict inequality will not convert data types.", - "Examples
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
", + "Examples", + "
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
", "

Instructions

", "Add the strict inequality operator to the if statement so the function will return \"Not Equal\" when val is not strictly equal to 17" ], @@ -2466,7 +2478,8 @@ "title": "Comparison with the Greater Than Operator", "description": [ "The greater than operator (>) compares the values of two numbers. If the number to the left is greater than the number to the right, it returns true. Otherwise, it returns false.
Like the equality operator, greater than operator will convert data types of values while comparing.", - "Examples
5 > 3 // true
7 > '3' // true
2 > 3 // false
'1' > 9 // false
", + "Examples", + "
5 > 3 // true
7 > '3' // true
2 > 3 // false
'1' > 9 // false
", "

Instructions

", "Add the greater than operator to the indicated lines so that the return statements make sense." ], @@ -2520,7 +2533,8 @@ "title": "Comparison with the Greater Than Equal To Operator", "description": [ "The greater than equal to operator (>=) compares the values of two numbers. If the number to the left is greater than or equal to the number to the right, it returns true. Otherwise, it returns false.
Like the equality operator, greater than equal to operator will convert data types while comparing.", - "Examples
6 >= 6 // true
7 >= '3' // true
2 >= 3 // false
'7' >= 9 // false
", + "Examples", + "
6 >= 6 // true
7 >= '3' // true
2 >= 3 // false
'7' >= 9 // false
", "

Instructions

", "Add the greater than equal to operator to the indicated lines so that the return statements make sense." ], @@ -2577,7 +2591,8 @@ "title": "Comparison with the Less Than Operator", "description": [ "The less than operator (<) compares the values of two numbers. If the number to the left is less than the number to the right, it returns true. Otherwise, it returns false. Like the equality operator, less than operator converts data types while comparing.", - "Examples
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
", + "Examples", + "
2 < 5 // true
'3' < 7 // true
5 < 5 // false
3 < 2 // false
'8' < 4 // false
", "

Instructions

", "Add the less than operator to the indicated lines so that the return statements make sense." ], @@ -2633,7 +2648,8 @@ "title": "Comparison with the Less Than Equal To Operator", "description": [ "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equl the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", - "Examples
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", + "Examples", + "
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", "

Instructions

", "Add the less than equal to operator to the indicated lines so that the return statements make sense." ], @@ -2881,7 +2897,7 @@ "title": "Introducing Else Statements", "description": [ "When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.", - "
if (num > 10) {
return \"Bigger than 10\";
} else {
return \"10 or Less\";
}
", + "
if (num > 10) {
return \"Bigger than 10\";
} else {
return \"10 or Less\";
}
", "

Instructions

", "Combine the if statements into a single statement." ], @@ -3180,11 +3196,12 @@ "title": "Multiple Identical Options in Switch Statements", "description": [ "If the break statement is ommitted from a switch statement case, the following case statement(s) are executed unless a break is encountered. If you have mutiple inputs with the same output, you can represent them in a switch statement like this:", - "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", + "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", "Cases for 1, 2, and 3 will all produce the same result.", "

Instructions

", - "Write a switch statement to set answer for the following ranges:
1-3 - \"Low\"
4-6 - \"Mid\"
7-9 - \"High\"", - "Note
You will need to have a case statement for each number in the range." + "Write a switch statement to set answer for the following ranges:
1-3 - \"Low\"
4-6 - \"Mid\"
7-9 - \"High\"", + "Note", + "You will need to have a case statement for each number in the range." ], "releasedOn": "11/27/2015", "tests": [ @@ -3333,9 +3350,9 @@ "description": [ "You may recall from Comparison with the Equality Operator that all comparison operators return a boolean true or false value.", "A common anti-pattern is to use an if/else statement to do a comparison and then return true/false:", - "
function isEqual(a,b) {
if(a === b) {
return true;
} else {
return false;
}
}
", + "
function isEqual(a,b) {
if(a === b) {
return true;
} else {
return false;
}
}
", "Since === returns true or false, we can simply return the result of the comparion:", - "
function isEqual(a,b) {
return a === b;
}
", + "
function isEqual(a,b) {
return a === b;
}
", "

Instructions

", "Fix the function isLess to remove the if/else statements." ], @@ -3376,51 +3393,47 @@ "id": "56533eb9ac21ba0edf2244c4", "title": "Return Early Pattern for Functions", "description": [ - "When a return statement is reached, the execution of the current function stops at that point. " + "When a return statement is reached, the execution of the current function stops and control returns to the calling location.", + "Example", + "
function myFun() {
console.log(\"Hello\");
return \"World\";
console.log(\"byebye\")
}
myFun();
", + "The above outputs \"Hello\" to the console, returns \"World\", but \"byebye\" is never output, because the function exits at the return statement.", + "

Instructions

", + "Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined." ], "releasedOn": "11/27/2015", "tests": [ - "assert(1===1, 'message: message here');" + "assert(typeof abTest(2,2) === 'number' , 'message: abTest(2,2) should return a number');", + "assert(abTest(2,2) === 8 , 'message: abTest(2,2) should return 8');", + "assert(abTest(-2,2) === undefined , 'message: abTest(-2,2) should return undefined');", + "assert(abTest(2,-2) === undefined , 'message: abTest(2,-2) should return undefined');", + "assert(abTest(2,8) === 18 , 'message: abTest(2,8) should return 18');", + "assert(abTest(3,3) === 12 , 'message: abTest(3,3) should return 12');" ], "challengeSeed": [ + "// Setup", + "function abTest(a, b) {", + " // Only change code below this line", + " ", + " ", + " ", + " // Only change code above this line", "", + " return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));", + "}", "", - "" + "// Change values below to test your code", + "abTest(2,2);" ], "tail": [ "" ], "solutions": [ - "" - ], - "type": "waypoint", - "challengeType": "1", - "nameCn": "", - "nameFr": "", - "nameRu": "", - "nameEs": "", - "namePt": "" - }, - { - "id": "56533eb9ac21ba0edf2244c5", - "title": "Optional Arguments for Functions", - "description": [ - "" - ], - "releasedOn": "11/27/2015", - "tests": [ - "assert(1===1, 'message: message here');" - ], - "challengeSeed": [ - "", - "", - "" - ], - "tail": [ - "" - ], - "solutions": [ - "" + "function abTest(a, b) {", + " if(a < 0 || b < 0) {", + " return undefined;", + " } ", + " return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));", + "}" ], "type": "waypoint", "challengeType": "1", @@ -3439,7 +3452,7 @@ "
ValueCards
+12, 3, 4, 5, 6
07, 8, 9
-110, 'J', 'Q', 'K','A'
", "You will write a card counting function. It will recieve a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count if positive, or \"Hold\" if the count is zero or negative.", "Example Output", - "-3 Hold
5 Bet" + "-3 Hold
5 Bet" ], "releasedOn": "11/27/2015", "tests": [ @@ -3503,7 +3516,7 @@ "You may have heard the term object before.", "Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties.", "Here's a sample object:", - "
var cat = {
\"name\": \"Whiskers\",
\"legs\": 4,
\"tails\": 1,
\"enemies\": [\"Water\", \"Dogs\"]
};
", + "
var cat = {
\"name\": \"Whiskers\",
\"legs\": 4,
\"tails\": 1,
\"enemies\": [\"Water\", \"Dogs\"]
};
", "Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.", "

Instructions

", "Make an object that represents a dog called myDog which contains the properties \"name\" (a string), \"legs\", \"tails\" and \"friends\".", @@ -3549,7 +3562,7 @@ "There are two ways to access the properties of an object: the dot operator (.) and bracket notation ([]), similar to an array.", "The dot operator is what you use when you know the name of the property you're trying to access ahead of time.", "Here is a sample of using the . to read an object property:", - "
var myObj = {
prop1: \"val1\",
prop2: \"val2\"
};
myObj.prop1; // val1
myObj.prop2; // val2
", + "
var myObj = {
prop1: \"val1\",
prop2: \"val2\"
};
myObj.prop1; // val1
myObj.prop2; // val2
", "

Instructions

", "Read the values of the properties hat and shirt of testObj using dot notation." ], @@ -3600,7 +3613,7 @@ "description": [ "The second way to access the properties of an objectis bracket notation ([]). If the property of the object you are trying to access has a space in it, you will need to use bracket notation.", "Here is a sample of using bracket notation to read an object property:", - "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", + "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", "Note that property names with spaces in them must be in quotes (single or double).", "

Instructions

", "Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation." @@ -3652,7 +3665,7 @@ "description": [ "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for itterating through lists of object properties or for doing lookups.", "Here is an example of using a variable to access a property:", - "
var someProp = \"propName\";
var myObj = {
propName: \"Some Value\"
}
myObj[someProp]; // \"Some Value\"
", + "
var someProp = \"propName\";
var myObj = {
propName: \"Some Value\"
}
myObj[someProp]; // \"Some Value\"
", "Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name", "

Instructions

", "Use the playerNumber variable to lookup player 16 in testObj using bracket notation." @@ -3697,7 +3710,7 @@ "description": [ "After you've created a JavaScript object, you can update its properties at any time just like you would update any other variable. You can use either dot or bracket notation to update.", "For example, let's look at ourDog:", - "
var ourDog = {
\"name\": \"Camper\",
\"legs\": 4,
\"tails\": 1,
\"friends\": [\"everything!\"]
};
", + "
var ourDog = {
\"name\": \"Camper\",
\"legs\": 4,
\"tails\": 1,
\"friends\": [\"everything!\"]
};
", "Since he's a particularly happy dog, let's change his name to \"Happy Camper\". Here's how we update his object's name property:", "ourDog.name = \"Happy Camper\"; or", "outDog[\"name\"] = \"Happy Camper\";", @@ -3853,7 +3866,7 @@ "description": [ "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if...else chain. This is most useful when you know that your input data is limited to a certain range.", "Here is an example of a simple reverse alphabet lookup:", - "
var alpha = {
1:\"Z\"
2:\"Y\"
3:\"X\"
...
4:\"W\"
24:\"C\"
25:\"B\"
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", + "
var alpha = {
1:\"Z\"
2:\"Y\"
3:\"X\"
...
4:\"W\"
24:\"C\"
25:\"B\"
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", "

Instructions

", "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." ], @@ -3950,8 +3963,8 @@ "title": "Testing Objects for Properties", "description": [ "Sometimes it is useful to check of the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.", - "Example:", - "
var myObj = {
top: \"hat\",
bottom: \"pants\"
};
myObj.hasOwnProperty(\"hat\"); // true
myObj.hasOwnProperty(\"middle\"); // false
", + "Example", + "
var myObj = {
top: \"hat\",
bottom: \"pants\"
};
myObj.hasOwnProperty(\"hat\"); // true
myObj.hasOwnProperty(\"middle\"); // false
", "

Instructions

", " Modify function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not return \"Not Found\"." ], @@ -4003,7 +4016,7 @@ "description": [ "JavaScript Object Notation or JSON uses the format of Javascript Objects to store data. JSON is flexible becuase it allows for data structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects. ", "Here is an example of a JSON object:", - "
var ourMusic = [
{
\"artist\": \"Daft Punk\",
\"title\": \"Homework\",
\"release_year\": 1997,
\"formats\": [
\"CD\",
\"Cassette\",
\"LP\" ],
\"gold\": true
}
];
", + "
var ourMusic = [
{
\"artist\": \"Daft Punk\",
\"title\": \"Homework\",
\"release_year\": 1997,
\"formats\": [
\"CD\",
\"Cassette\",
\"LP\" ],
\"gold\": true
}
];
", "This is an array of objects and the object has various peices of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", "

Instructions

", "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." @@ -4080,7 +4093,7 @@ "description": [ "The properties and sub-properties of JSON objects can be accessed by chaining together the dot or bracket notation.", "Here is a nested JSON Object:", - "
var ourStorage = {
\"desk\": {
\"drawer\": \"stapler\"
},
\"cabinet\": {
\"top drawer\": {
\"folder1\": \"a file\",
\"folder2\": \"secrets\"
},
\"bottom drawer\": \"soda\"
}
}
ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"
ourStoage.desk.drawer; // \"stapler\"
", + "
var ourStorage = {
\"desk\": {
\"drawer\": \"stapler\"
},
\"cabinet\": {
\"top drawer\": {
\"folder1\": \"a file\",
\"folder2\": \"secrets\"
},
\"bottom drawer\": \"soda\"
}
}
ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"
ourStoage.desk.drawer; // \"stapler\"
", "

Instructions

", "Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." ], @@ -4139,7 +4152,7 @@ "description": [ "As we have seen in earlier examples, JSON objects can contain both nested objects and nested arrays. Similar to accessing nested objects, Array bracket notation can be chained to access nested arrays.", "Here is an example of how to access a nested array:", - "
var ourPets = {
\"cats\": [
\"Meowzer\",
\"Fluffy\",
\"Kit-Cat\"
],
\"dogs:\" [
\"Spot\",
\"Bowser\",
\"Frankie\"
]
};
ourPets.cats[1]; // \"Fluffy\"
ourPets.dogs[0]; // \"Spot\"
", + "
var ourPets = {
\"cats\": [
\"Meowzer\",
\"Fluffy\",
\"Kit-Cat\"
],
\"dogs:\" [
\"Spot\",
\"Bowser\",
\"Frankie\"
]
};
ourPets.cats[1]; // \"Fluffy\"
ourPets.dogs[0]; // \"Spot\"
", "

Instructions

", "Retrieve the second tree using object dot and array bracket notation." ], @@ -4343,7 +4356,7 @@ "The condition statement is evaluated at the beginning of every loop iteration and will continue as long as it evalutes to true. When condition is false at the start of the iteration, the loop will stop executing. This means if condition starts as false, your loop will never execute.", "The final-expression is executed at the end of each loop iteration, prior to the next condition check and is usually used to increment or decrement your loop counter.", "In the following example we initialize with i = 0 and iterate while our condition i < 5 is true. We'll increment i by 1 in each loop iteration with i++ as our final-expression.", - "
var ourArray = [];
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
", + "
var ourArray = [];
for (var i = 0; i < 5; i++) {
ourArray.push(i);
}
", "ourArray will now contain [0,1,2,3,4].", "

Instructions

", "Use a for loop to work to push the values 1 through 5 onto myArray." @@ -4379,7 +4392,7 @@ "description": [ "For loops don't have to iterate one at a time. By changing our final-expression, we can count by even numbers.", "We'll start at i = 0 and loop while i < 10. We'll increment i by 2 each loop with i += 2.", - "
var ourArray = [];
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
", + "
var ourArray = [];
for (var i = 0; i < 10; i += 2) {
ourArray.push(i);
}
", "ourArray will now contain [0,2,4,6,8].", "Let's change our initialization so we can count by odd numbers.", "

Instructions

", @@ -4417,7 +4430,7 @@ "A for loop can also count backwards, so long as we can define the right conditions.", "In order to count backwards by twos, we'll need to change our initialization, condition, and final-expression.", "We'll start at i = 10 and loop while i > 0. We'll decrement i by 2 each loop with i -= 2.", - "
var ourArray = [];
for (var i=10; i > 0; i-=2) {
ourArray.push(i);
}
", + "
var ourArray = [];
for (var i=10; i > 0; i-=2) {
ourArray.push(i);
}
", "ourArray will now contain [10,8,6,4,2].", "Let's change our initialization and final-expression so we can count backward by twos by odd numbers.", "

Instructions

", @@ -4452,7 +4465,7 @@ "title": "Iterate Through an Array with a For Loop", "description": [ "A common task in Javascript is to iterate through the contents of an array. One way to do that is with a for loop. This code will output each element of the array arr to the console:", - "
var arr = [10,9,8,7,6];
for (var i=0; i < arr.length; i++) {
console.log(arr[i]);
}
", + "
var arr = [10,9,8,7,6];
for (var i=0; i < arr.length; i++) {
console.log(arr[i]);
}
", "Remember that Arrays have zero-based numbering, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops when i is at length - 1.", "

Instructions

", "Create a variable total. Use a for loop to add each element of myArr to total." @@ -4503,7 +4516,7 @@ "title": "Nesting For Loops", "description": [ "If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:", - "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; k < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", + "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; k < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", "This outputs each sub-element in arr one at a time. Note that for the inner loop we are checking the .length of arr[i], since arr[i] is itself an array.", "

Instructions

", "Modify function multiplyAll so that it multiplies product by each number in the subarrays of arr" @@ -4559,7 +4572,7 @@ "description": [ "You can run the same code multiple times by using a loop.", "Another type of JavaScript loop is called a \"while loop\", because it runs \"while\" something is true and stops once that something is no longer true.", - "
var ourArray = [];
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
", + "
var ourArray = [];
var i = 0;
while(i < 5) {
ourArray.push(i);
i++;
}
", "Let's try getting a while loop to work by pushing values to an array.", "

Instructions

", "Push the numbers 0 through 4 to myArray using a while loop." @@ -4673,8 +4686,9 @@ " return 0;", "", " // Only change code above this line.", - "}", - "", + "}" + ], + "tail": [ "(function(){return myFunction();})();" ], "type": "waypoint", @@ -4709,8 +4723,6 @@ " // Only change code below this line.", "", " return Math.random();", - "", - " // Only change code above this line.", "}" ], "tail": [ @@ -4757,11 +4769,9 @@ "", " return;", "", - "}", - "", - "// Only change code above this line.", - "", - "", + "}" + ], + "tail": [ "(function(){return myFunction();})();" ], "type": "waypoint", @@ -4785,8 +4795,13 @@ "assert(test==2, 'message: Your regular expression should find two occurrences of the word and.');", "assert(editor.getValue().match(/\\/and\\/gi/), 'message: Use regular expressions to find the word and in testString.');" ], + "head": [ + "" + ], "challengeSeed": [ + "// Setup", "var test = (function() {", + " // Example", " var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";", " var expressionToGetSoftware = /software/gi;", "", @@ -4794,11 +4809,13 @@ "", " var expression = /./gi;", "", - " // Only change code above this line.", - "", + " // Only change code above this line", " return testString.match(expression).length;", "})();(function(){return test;})();" ], + "tail": [ + "" + ], "type": "waypoint", "challengeType": "1" }, @@ -4816,6 +4833,9 @@ "assert(editor.getValue().match(/\\/\\\\d\\+\\//g), 'message: Use the /\\d+/g regular expression to find the numbers in testString.');", "assert(test === 2, 'message: Your regular expression should find two numbers in testString.');" ], + "head": [ + "var test = (function() {" + ], "challengeSeed": [ "var test = (function() {", "", @@ -4824,11 +4844,10 @@ " // Only change code below this line.", "", " var expression = /.+/g;", - "", - " // Only change code above this line.", - "", + "" + ], + "tail": [ " return testString.match(expression).length;", - "", "})();(function(){return test;})();" ], "type": "waypoint", @@ -4848,16 +4867,18 @@ "assert(editor.getValue().match(/\\/\\\\s\\+\\//g), 'message: Use the /\\s+/g regular expression to find the spaces in testString.');", "assert(test === 7, 'message: Your regular expression should find seven spaces in testString.');" ], + "head": [ + "var test = (function() {" + ], "challengeSeed": [ - "var test = (function(){", " var testString = \"How many spaces are there in this sentence?\";", "", " // Only change code below this line.", "", " var expression = /.+/g;", - "", - " // Only change code above this line.", - "", + "" + ], + "tail": [ " return testString.match(expression).length;", "", "})();(function(){return test;})();" @@ -4877,16 +4898,18 @@ "assert(editor.getValue().match(/\\/\\\\S\\/g/g), 'message: Use the /\\S/g regular expression to find non-space characters in testString.');", "assert(test === 49, 'message: Your regular expression should find forty nine non-space characters in the testString.');" ], + "head": [ + "var test = (function() {" + ], "challengeSeed": [ - "var test = (function(){", " var testString = \"How many non-space characters are there in this sentence?\";", "", " // Only change code below this line.", "", " var expression = /./g;", - "", - " // Only change code above this line.", - "", + "" + ], + "tail": [ " return testString.match(expression).length;", "})();(function(){return test;})();" ], From f57459f0396ed8837170b5933e38b802d905a6c7 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Sun, 27 Dec 2015 12:23:58 -0800 Subject: [PATCH 090/174] Corrections from Live Stream --- .../basic-javascript.json | 194 +++++++++--------- 1 file changed, 101 insertions(+), 93 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index f22792c3a7..b1af365971 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -87,7 +87,7 @@ "id": "56533eb9ac21ba0edf2244a8", "title": "Storing Values with the Equal Operator", "description": [ - "In Javascript, you can store a value in a variable with the = or assignment operator.", + "In Javascript, you can store a value in a variable with the assignment or equal (=) operator.", "myVariable = 5;", "Assigns the Number value 5 to myVariable.", "Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.", @@ -225,7 +225,7 @@ "Examples:", "
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", "

Instructions

", - "Correct the variable assignements so their names match their variable declarations above." + "Correct the variable assignments so their names match their variable declarations above." ], "releasedOn": "11/27/2015", "tests": [ @@ -272,7 +272,7 @@ "JavaScript uses the + symbol as addition operation when placed between two numbers.", "", "Example", - "
5 + 10 = 15
", + "
myVar = 5 + 10; // assigned 15
", "", "

Instructions

", "Change the 0 so that sum will equal 20." @@ -299,10 +299,10 @@ "JavaScript uses the - symbol for subtraction.", "", "Example", - "
12 - 6 = 6
", + "
myVAr = 12 - 6; // assigned 6
", "", "

Instructions

", - "Change the 0 so that difference will equal 12." + "Change the 0 so the difference is 12." ], "tests": [ "assert(difference === 12, 'message: Make the variable difference equal 12.');", @@ -330,7 +330,7 @@ "JavaScript uses the * symbol for multiplication of two numbers.", "", "Example", - "
13 * 13 = 169
", + "
myVar = 13 * 13; // assigned 169
", "", "

Instructions

", "Change the 0 so that product will equal 80." @@ -361,10 +361,10 @@ "JavaScript uses the / symbol for division.", "", "Example", - "
16 / 2 = 8
", + "
myVar = 16 / 2; // assigned 8
", "", "

Instructions

", - "Change the 0 so that quotient will equal to 2." + "Change the 0 so that the quotient is equal to 2." ], "tests": [ "assert(quotient === 2, 'message: Make the variable quotient equal to 2.');", @@ -387,7 +387,7 @@ "description": [ "You can easily increment or add one to a variable with the ++ operator.", "i++;", - "is the equivilent of", + "is the equivalent of", "i = i + 1;", "

Instructions

", "Change the code to use the ++ operator on myVar" @@ -426,7 +426,7 @@ "description": [ "You can easily decrement or decrease a variable by one with the -- operator.", "i--;", - "is the equivilent of", + "is the equivalent of", "i = i - 1;", "

Instructions

", "Change the code to use the -- operator on myVar" @@ -466,8 +466,8 @@ "We can store decimal numbers in variables too. Decimal numbers are sometimes refered to as floating point numbers or floats. ", "Note", "Not all real numbers can accurately be represented in floating point. This can lead to rounding errors. Details Here.", - "", - "Let's create a variable myDecimal and give it a decimal value." + "

Instructions

", + "Create a variable myDecimal and give it a decimal value." ], "tests": [ "assert(typeof myDecimal === \"number\", 'message: myDecimal should be a number.');", @@ -492,6 +492,7 @@ "description": [ "In JavaScript, you can also perform calculations with decimal numbers, just like whole numbers.", "Let's multiply two decimals together to get their product.", + "

Instructions

", "Change the 0.0 so that product will equal 5.0." ], "tests": [ @@ -514,6 +515,7 @@ "title": "Divide one Decimal by Another with JavaScript", "description": [ "Now let's divide one decimal by another.", + "

Instructions

", "Change the 0.0 so that quotient will equal to 2.2." ], "tests": [ @@ -533,16 +535,18 @@ }, { "id": "56533eb9ac21ba0edf2244ae", - "title": "Find a Remainder with Modulus", + "title": "Finding a Remainder in Javascript", "description": [ - "The modulus operator % gives the remainder of the division of two numbers.", + "The remainder operator % gives the remainder of the division of two numbers. ", "Example", "
5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
", "Usage", - "In Maths, a number can be checked even or odd by checking the remainder of division of the number by 2. ", + "In mathematics, a number can be checked even or odd by checking the remainder of division of the number by 2. ", "
17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)
", + "Note", + "The remainder operator is sometimes incorrectly refered to as the \"modulus\" operator. It is very similar to modulus, but does not work properly with negative numbers.", "

Instructions

", - "Set remainder equal to the remainder of 11 divided by 3 using the modulus operator." + "Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator." ], "releasedOn": "11/27/2015", "tests": [ @@ -917,6 +921,9 @@ "", "" ], + "tail": [ + "(function() { return \"myStr = \" + myStr; })();" + ], "solutions": [ "var myStr = 'Link';" ], @@ -1358,7 +1365,7 @@ "releasedOn": "11/27/2015", "tests": [ "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string');", - "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 50, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 50 characters with empty inputs');", + "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 30, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 30 characters with empty inputs');", "assert(/dog/.test(test1) && /big/.test(test1) && /ran/.test(test1) && /quickly/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words.');", "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" ], @@ -2820,78 +2827,6 @@ "nameEs": "", "namePt": "" }, - { - "id": "5664820f61c48e80c9fa476c", - "title": "Golf Code", - "description": [ - "In the game of golf each hole has a par for the average number of strokes needed to sink the ball. Depending on how far above or below par your stokes are, there is a different nickname.", - "Your function will be passed a par and strokes. Return strings according to this table (based on order of priority - top (highest) to bottom (lowest)):", - "
StokesReturn
1\"Hole-in-one!\"
<= par - 2\"Eagle\"
par - 1\"Birdie\"
par\"Par\"
par + 1\"Bogey\"
par + 2\"Double Bogey\"
>= par + 3\"Go Home!\"
", - "par and strokes will always be numeric and positive." - ], - "releasedOn": "11/27/2015", - "tests": [ - "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", - "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", - "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", - "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", - "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", - "assert(golfScore(1, 1) === \"Hole-in-one!\", 'message: golfScore(1, 1) should return \"Hole-in-one!\"');", - "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", - "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", - "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", - "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", - "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" - ], - "challengeSeed": [ - "function golfScore(par, strokes) {", - " // Only change code below this line", - " ", - " ", - " return \"Change Me\";", - " // Only change code above this line", - "}", - "", - "// Change these values to test", - "golfScore(5, 4);" - ], - "solutions": [ - "function golfScore(par, strokes) {", - " if (strokes === 1) {", - " return \"Hole-in-one!\";", - " }", - " ", - " if (strokes <= par - 2) {", - " return \"Eagle\";", - " }", - " ", - " if (strokes === par - 1) {", - " return \"Birdie\";", - " }", - " ", - " if (strokes === par) {", - " return \"Par\";", - " }", - " ", - " if (strokes === par + 1) {", - " return \"Bogey\";", - " }", - " ", - " if(strokes === par + 2) {", - " return \"Double Bogey\";", - " }", - " ", - " return \"Go Home!\";", - "}" - ], - "type": "bonfire", - "challengeType": "5", - "nameCn": "", - "nameFr": "", - "nameRu": "", - "nameEs": "", - "namePt": "" - }, { "id": "56533eb9ac21ba0edf2244da", "title": "Introducing Else Statements", @@ -3066,6 +3001,78 @@ "nameEs": "", "namePt": "" }, + { + "id": "5664820f61c48e80c9fa476c", + "title": "Golf Code", + "description": [ + "In the game of golf each hole has a par for the average number of strokes needed to sink the ball. Depending on how far above or below par your strokes are, there is a different nickname.", + "Your function will be passed a par and strokes. Return strings according to this table (based on order of priority - top (highest) to bottom (lowest)):", + "
StrokesReturn
1\"Hole-in-one!\"
<= par - 2\"Eagle\"
par - 1\"Birdie\"
par\"Par\"
par + 1\"Bogey\"
par + 2\"Double Bogey\"
>= par + 3\"Go Home!\"
", + "par and strokes will always be numeric and positive." + ], + "releasedOn": "11/27/2015", + "tests": [ + "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", + "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", + "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(5, 2) should return \"Eagle\"');", + "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", + "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", + "assert(golfScore(1, 1) === \"Hole-in-one!\", 'message: golfScore(1, 1) should return \"Hole-in-one!\"');", + "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", + "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", + "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", + "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", + "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" + ], + "challengeSeed": [ + "function golfScore(par, strokes) {", + " // Only change code below this line", + " ", + " ", + " return \"Change Me\";", + " // Only change code above this line", + "}", + "", + "// Change these values to test", + "golfScore(5, 4);" + ], + "solutions": [ + "function golfScore(par, strokes) {", + " if (strokes === 1) {", + " return \"Hole-in-one!\";", + " }", + " ", + " if (strokes <= par - 2) {", + " return \"Eagle\";", + " }", + " ", + " if (strokes === par - 1) {", + " return \"Birdie\";", + " }", + " ", + " if (strokes === par) {", + " return \"Par\";", + " }", + " ", + " if (strokes === par + 1) {", + " return \"Bogey\";", + " }", + " ", + " if(strokes === par + 2) {", + " return \"Double Bogey\";", + " }", + " ", + " return \"Go Home!\";", + "}" + ], + "type": "bonfire", + "challengeType": "5", + "nameCn": "", + "nameFr": "", + "nameRu": "", + "nameEs": "", + "namePt": "" + }, { "id": "56533eb9ac21ba0edf2244dd", "title": "Selecting from many options with Switch Statements", @@ -3450,7 +3457,7 @@ "In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called Card Counting. ", "Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.", "
ValueCards
+12, 3, 4, 5, 6
07, 8, 9
-110, 'J', 'Q', 'K','A'
", - "You will write a card counting function. It will recieve a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count if positive, or \"Hold\" if the count is zero or negative.", + "You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count if positive, or \"Hold\" if the count is zero or negative.", "Example Output", "-3 Hold
5 Bet" ], @@ -4017,7 +4024,7 @@ "JavaScript Object Notation or JSON uses the format of Javascript Objects to store data. JSON is flexible becuase it allows for data structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects. ", "Here is an example of a JSON object:", "
var ourMusic = [
{
\"artist\": \"Daft Punk\",
\"title\": \"Homework\",
\"release_year\": 1997,
\"formats\": [
\"CD\",
\"Cassette\",
\"LP\" ],
\"gold\": true
}
];
", - "This is an array of objects and the object has various peices of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", + "This is an array of objects and the object has various pieces of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", "

Instructions

", "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." ], @@ -4234,7 +4241,7 @@ "id": "56533eb9ac21ba0edf2244cf", "title": "Record Collection", "description": [ - "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unqiue id number and which has several properties. Not all albums have complete information.", + "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and which has several properties. Not all albums have complete information.", "Write a function which takes an id, a property (prop), and a value.", "For the given id in collection:", "If value is non-blank (value !== \"\"), then update or set the value for the prop.", @@ -4250,6 +4257,7 @@ "update(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After update(2548, \"tracks\", \"\"), tracks should not be set');" ], "challengeSeed": [ + "// Setup", "var collection = {", " 2548: {", " album: \"Slippery When Wet\",", @@ -5572,4 +5580,4 @@ "challengeType": "0" } ] -} +} \ No newline at end of file From 11d439c5d9872ae47f52481f15e056f120797605 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Sun, 27 Dec 2015 13:49:22 -0800 Subject: [PATCH 091/174] More Improvements --- .../basic-javascript.json | 130 +++++++++--------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index b1af365971..726f9d9f62 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -98,7 +98,7 @@ "Assign the value 7 to variable a", "Assign the contents of a to variable b." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(/var a;/.test(editor.getValue()) && /var b = 2;/.test(editor.getValue()), 'message: Do not change code above the line');", "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", @@ -142,7 +142,7 @@ "

Instructions

", "Define a variable a with var and initialize it to a value of 9." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(/var\\s+a\\s*=\\s*9\\s*/.test(editor.getValue()), 'message: Initialize a to a value of 9');" ], @@ -175,7 +175,7 @@ "

Instructions

", "Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof a === 'number' && a === 6, 'message: a should be defined and have a value of 6');", "assert(typeof b === 'number' && b === 15, 'message: b should be defined and have a value of 15');", @@ -227,7 +227,7 @@ "

Instructions

", "Correct the variable assignments so their names match their variable declarations above." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(StUdLyCapVaR === 10, 'message: StUdLyCapVaR has the correct case');", "assert(properCamelCase === \"A String\", 'message: properCamelCase has the correct case');", @@ -392,7 +392,7 @@ "

Instructions

", "Change the code to use the ++ operator on myVar" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myVar === 88, 'message: myVar should equal 88');", "assert(/[+]{2}/.test(editor.getValue()), 'message: Use the ++ operator');", @@ -431,7 +431,7 @@ "

Instructions

", "Change the code to use the -- operator on myVar" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myVar === 10, 'message: myVar should equal 10');", "assert(/myVar[-]{2}/.test(editor.getValue()), 'message: Use the -- operator on myVar');", @@ -548,7 +548,7 @@ "

Instructions

", "Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(remainder === 2, 'message: The value of remainder should be 2');", "assert(/\\d+\\s*%\\s*\\d+/.test(editor.getValue()), 'message: You should use the % operator');" @@ -585,7 +585,7 @@ "

Instructions

", "Convert the assignments for a, b, and c to use the += operator." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(a === 15, 'message: a should equal 15');", "assert(b === 26, 'message: b should equal 26');", @@ -636,7 +636,7 @@ "

Instructions

", "Convert the assignments for a, b, and c to use the -= operator." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(a === 5, 'message: a should equal 5');", "assert(b === -6, 'message: b should equal -6');", @@ -690,7 +690,7 @@ "

Instructions

", "Convert the assignments for a, b, and c to use the *= operator." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(a === 25, 'message: a should equal 25');", "assert(b === 36, 'message: b should equal 36');", @@ -742,7 +742,7 @@ "

Instructions

", "Convert the assignments for a, b, and c to use the /= operator." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(a === 4, 'message: a should equal 4');", "assert(b === 27, 'message: b should equal 27');", @@ -790,7 +790,7 @@ "The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.", "You are given a variable Tc representing a temperature in Celsius. Create a variable Tf and apply the algorithm to assign it the corresponding temperature in Fahrenheit." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof convert(0) === 'number', 'message: convert(0) should return a number');", "assert(convert(-30) === -22, 'message: convert(-30) should return a value of -22');", @@ -879,7 +879,7 @@ "Use backslashes to assign the following to myStr variable:", "\"I am a \"double quoted\" string inside \"double quotes\"\"" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(editor.getValue().match(/\\\\\"/g).length === 4 && editor.getValue().match(/[^\\\\]\"/g).length === 2, 'message: You should use two double quotes (") and four escaped double quotes (\") ');" ], @@ -910,7 +910,7 @@ "

Instructions

", "Change the provided string from double to single quotes and remove the escaping." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(!/\\\\/g.test(editor.getValue()), 'message: Remove all the backslashes (\\)');", "assert(editor.getValue().match(/\"/g).length === 4 && editor.getValue().match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "');", @@ -945,7 +945,7 @@ "

Instructions

", "Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myStr === \"\\\\ \\t \\t \\r \\n\", 'message: myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces');" ], @@ -977,7 +977,7 @@ "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator.", "" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end');", "assert(editor.getValue().match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" @@ -1011,7 +1011,7 @@ "

Instructions

", "Build myStr over several lines by concatenating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myStr === \"This is the first line. This is the second line.\", 'message: myStr should have a value of This is the first line. This is the second line.');", "assert(editor.getValue().match(/\\w\\s*\\+=\\s*\"/g).length > 1 && editor.getValue().match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" @@ -1047,7 +1047,7 @@ "

Instructions

", "Set myName and build myStr with myName between the strings \"My name is \" and \" and I am swell!\"" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof myName !== 'undefined' && myName.length > 2, 'message: myName should be set to a string at least 3 characters long');", "assert(editor.getValue().match(/\"\\s*\\+\\s*myName\\s*\\+\\s*\"/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" @@ -1083,7 +1083,7 @@ "

Instructions

", "Set someAdjective and append it to myStr using the += operator." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, 'message: someAdjective should be set to a string at least 3 characters long');", "assert(editor.getValue().match(/\\w\\s*\\+=\\s*someAdjective\\s*;/).length > 0, 'message: Append someAdjective to myStr using the += operator');" @@ -1119,7 +1119,7 @@ }, { "id": "bd7123c9c448eddfaeb5bdef", - "title": "Find Length of a String", + "title": "Find the Length of a String", "description": [ "You can find the length of a String value by writing .length after the string variable or string literal.", "\"Alan Peter\".length; // 10", @@ -1210,7 +1210,7 @@ "

Instructions

", "Correct the assignment to myStr to achieve the desired effect." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myStr === \"Hello World\", 'message: myStr should have a value of Hello World');", "assert(/myStr = \"Jello World\"/.test(editor.getValue()), 'message: Do not change the code above the line');" @@ -1362,7 +1362,7 @@ "myNoun, myAdjective, myVerb, and myAdverb.", "The tests will run your function with several different inputs to make sure it works properly." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string');", "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 30, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 30 characters with empty inputs');", @@ -1544,6 +1544,7 @@ "

Instructions

", "Read from myArray using bracket notation so that myData is equal to 8" ], + "releasedOn": "January 1, 2016", "tests": [ "assert(myData === 8, 'message: myData should be equal to 8.');", "assert(/myArray\\[2\\]\\[1\\]/g.test(editor.getValue()), 'message: You should be using bracket notation to read the value from myArray.');" @@ -1728,7 +1729,7 @@ "[\"Chocolate Bar\", 15]", "There should be at least 5 sub-arrays in the list." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(isArray, 'message: myList should be an array');", "assert(hasString, 'message: The first elements in each of your sub-arrays must all be strings');", @@ -1855,7 +1856,7 @@ "

Instructions

", "
  1. Create a function called myFunction that accepts two arguments and outputs their sum to the dev console.
  2. Call the function.
" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", "capture(); myFunction(1,2); uncapture(); assert(logOutput == 3, 'message: myFunction(1,2) should output 3');", @@ -1919,7 +1920,7 @@ "Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10 ", "Inside function fun1, assign 5 to oopsGlobal without using the var keyword." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof myGlobal != \"undefined\", 'message: myGlobal should be defined');", "assert(myGlobal === 10, 'message: myGlobal should have a value of 10');", @@ -1992,7 +1993,7 @@ "

Instructions

", "Declare a local variable myVar inside myFunction" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "" ], @@ -2047,7 +2048,7 @@ "

Instructions

", "Add a local variable to myFunction to override the value of outerWear with \"sweater\"." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(outerWear === \"T-Shirt\", 'message: Do not change the value of the global outerWear');", "assert(myFunction() === \"sweater\", 'message: myFunction should return \"sweater\"');", @@ -2094,7 +2095,7 @@ "

Instructions

", "Create a function timesFive that accepts one argument, multiplies it by 5, and returns the new value." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof timesFive === 'function', 'message: timesFive should be a function');", "assert(timesFive(5) === 25, 'message: timesFive(5) should return 25');", @@ -2138,7 +2139,7 @@ "

Instructions

", "Call process function with an argument of 7 and assign it's return value to the variable processed." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(processed === 2, 'message: processed should have a value of 10');", "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(editor.getValue()), 'message: You should assign process to processed');" @@ -2176,7 +2177,7 @@ "In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.", "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove and return the item at the front of the queue." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(queue([],1) === 1, 'message: queue([], 1) should return 1');", "assert(queue([2],1) === 2, 'message: queue([2], 1) should return 2');", @@ -2301,7 +2302,7 @@ "

Instructions

", "Add the equality operator to the indicated line so that the function will return \"Equal\" when val is equivalent to 12" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", "assert(myTest(12) === \"Equal\", 'message: myTest(12) should return \"Equal\"');", @@ -2347,7 +2348,7 @@ "

Instructions

", "Use strict equality operator in if statement so the function will return \"Equal\" when val is strictly equal to 7" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", "assert(myTest(7) === \"Equal\", 'message: myTest(7) should return \"Equal\"');", @@ -2392,7 +2393,7 @@ "

Instructions

", "Add the inequality operator != in the if statement so that the function will return \"Not Equal\" when val is not equivalent to 99" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(99) === \"Equal\", 'message: myTest(99) should return \"Equal\"');", "assert(myTest(\"99\") === \"Equal\", 'message: myTest(\"99\") should return \"Equal\"');", @@ -2439,7 +2440,7 @@ "

Instructions

", "Add the strict inequality operator to the if statement so the function will return \"Not Equal\" when val is not strictly equal to 17" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(17) === \"Equal\", 'message: myTest(17) should return \"Equal\"');", "assert(myTest(\"17\") === \"Not Equal\", 'message: myTest(\"17\") should return \"Not Equal\"');", @@ -2490,7 +2491,7 @@ "

Instructions

", "Add the greater than operator to the indicated lines so that the return statements make sense." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(0) === \"10 or Under\", 'message: myTest(0) should return \"10 or Under\"');", "assert(myTest(10) === \"10 or Under\", 'message: myTest(10) should return \"10 or Under\"');", @@ -2545,7 +2546,7 @@ "

Instructions

", "Add the greater than equal to operator to the indicated lines so that the return statements make sense." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(0) === \"9 or Under\", 'message: myTest(0) should return \"9 or Under\"');", "assert(myTest(9) === \"9 or Under\", 'message: myTest(9) should return \"9 or Under\"');", @@ -2603,7 +2604,7 @@ "

Instructions

", "Add the less than operator to the indicated lines so that the return statements make sense." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(0) === \"Under 25\", 'message: myTest(0) should return \"Under 25\"');", "assert(myTest(24) === \"Under 25\", 'message: myTest(24) should return \"Under 25\"');", @@ -2660,7 +2661,7 @@ "

Instructions

", "Add the less than equal to operator to the indicated lines so that the return statements make sense." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(0) === \"Smaller Than or Equal to 12\", 'message: myTest(0) should return \"Smaller Than or Equal to 12\"');", "assert(myTest(11) === \"Smaller Than or Equal to 12\", 'message: myTest(11) should return \"Smaller Than or Equal to 12\"');", @@ -2721,7 +2722,7 @@ "

Instructions

", "Combine the two if statements into one statement which will return \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, will return \"No\"." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(editor.getValue().match(/&&/g).length === 1, 'message: You should use the && operator once');", "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", @@ -2779,7 +2780,7 @@ "

Instructions

", "Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(editor.getValue().match(/\\|\\|/g).length === 1, 'message: You should use the || operator once');", "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", @@ -2836,7 +2837,7 @@ "

Instructions

", "Combine the if statements into a single statement." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", "assert(/else/g.test(editor.getValue()), 'message: You should use an else statement');", @@ -2894,7 +2895,7 @@ "
if (num > 15) {
return \"Bigger then 15\";
} else if (num < 5) {
return \"Smaller than 5\";
} else {
return \"Between 5 and 15\";
}
", "

Instructions

Convert the logic to use else if statements." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(editor.getValue().match(/else/g).length > 1, 'message: You should have at least two else statements');", "assert(editor.getValue().match(/if/g).length > 1, 'message: You should have at least two if statements');", @@ -2950,7 +2951,7 @@ "Write chained if/else if statements to fulfill the following conditions:", "num < 5 - return \"Tiny\"
num < 10 - return \"Small\"
num < 15 - return \"Medium\"
num < 20 - return \"Large\"
num >= 20 - return \"Huge\"" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(editor.getValue().match(/else/g).length > 3, 'message: You should have at least four else statements');", "assert(editor.getValue().match(/if/g).length > 3, 'message: You should have at least four if statements');", @@ -3010,7 +3011,7 @@ "
StrokesReturn
1\"Hole-in-one!\"
<= par - 2\"Eagle\"
par - 1\"Birdie\"
par\"Par\"
par + 1\"Bogey\"
par + 2\"Double Bogey\"
>= par + 3\"Go Home!\"
", "par and strokes will always be numeric and positive." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", @@ -3083,7 +3084,7 @@ "

Instructions

", "Write a switch statement to set answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(1) === \"alpha\", 'message: myTest(1) should have a value of \"alpha\"');", "assert(myTest(2) === \"beta\", 'message: myTest(2) should have a value of \"beta\"');", @@ -3145,7 +3146,7 @@ "

Instructions

", "Write a switch statement to set answer for the following conditions:
\"a\" - \"apple\"
\"b\" - \"bird\"
\"c\" - \"cat\"
default - \"stuff\"" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(\"a\") === \"apple\", 'message: myTest(\"a\") should have a value of \"apple\"');", "assert(myTest(\"b\") === \"bird\", 'message: myTest(\"b\") should have a value of \"bird\"');", @@ -3210,7 +3211,7 @@ "Note", "You will need to have a case statement for each number in the range." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(myTest(1) === \"Low\", 'message: myTest(1) should return \"Low\"');", "assert(myTest(2) === \"Low\", 'message: myTest(2) should return \"Low\"');", @@ -3282,7 +3283,7 @@ "

Instructions

", "Change the chained if/if else statements into a switch statement." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(!/else/g.test(editor.getValue()), 'message: You should not use any else statements');", "assert(!/if/g.test(editor.getValue()), 'message: You should not use any if statements');", @@ -3363,7 +3364,7 @@ "

Instructions

", "Fix the function isLess to remove the if/else statements." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(isLess(10,15) === true, 'message: isLess(10,15) should return true');", "assert(isLess(15, 10) === false, 'message: isLess(15,10) should return true');", @@ -3407,7 +3408,7 @@ "

Instructions

", "Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof abTest(2,2) === 'number' , 'message: abTest(2,2) should return a number');", "assert(abTest(2,2) === 8 , 'message: abTest(2,2) should return 8');", @@ -3461,7 +3462,7 @@ "Example Output", "-3 Hold
5 Bet" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === \"5 Bet\") {return true;} return false; })(), 'message: Cards Sequence 2, 3, 4, 5, 6 should return \"5 Bet\"');", "assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === \"0 Hold\") {return true;} return false; })(), 'message: Cards Sequence 7, 8, 9 should return \"0 Hold\"');", @@ -3573,7 +3574,7 @@ "

Instructions

", "Read the values of the properties hat and shirt of testObj using dot notation." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof hatValue === 'string' , 'message: hatValue should be a string');", "assert(hatValue === 'ballcap' , 'message: The value of hatValue should be \"ballcap\"');", @@ -3625,7 +3626,7 @@ "

Instructions

", "Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof entreeValue === 'string' , 'message: entreeValue should be a string');", "assert(entreeValue === 'hamburger' , 'message: The value of entreeValue should be \"hamburger\"');", @@ -3677,7 +3678,7 @@ "

Instructions

", "Use the playerNumber variable to lookup player 16 in testObj using bracket notation." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(typeof playerNumber === 'number', 'message: playerNumber should be a number');", "assert(typeof player === 'string', 'message: The variable player should be a string');", @@ -3877,7 +3878,7 @@ "

Instructions

", "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(numberLookup(0) === 'zero', 'message: numberLookup(0) should equal \"zero\"');", "assert(numberLookup(1) === 'one', 'message: numberLookup(1) should equal \"one\"');", @@ -3975,6 +3976,7 @@ "

Instructions

", " Modify function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not return \"Not Found\"." ], + "releasedOn": "January 1, 2016", "tests": [ "assert(checkObj(\"gift\") === \"pony\", 'message: checkObj(\"gift\") should return \"pony\".');", "assert(checkObj(\"pet\") === \"kitten\", 'message: checkObj(\"gift\") should return \"kitten\".');", @@ -4028,7 +4030,7 @@ "

Instructions

", "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(Array.isArray(myMusic), 'message: myMusic should be an array');", "assert(myMusic.length > 1, 'message: myMusic should have at least two elements');", @@ -4104,7 +4106,7 @@ "

Instructions

", "Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(gloveBoxContents === \"maps\", 'message: gloveBoxContents should equal \"maps\"');", "assert(/=\\s*myStorage\\.car\\.inside\\[([\"'])glove box\\1\\]/.test(editor.getValue()), 'message: Use dot and bracket notation to access myStorage');" @@ -4163,7 +4165,7 @@ "

Instructions

", "Retrieve the second tree using object dot and array bracket notation." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(secondTree === \"pine\", 'message: secondTree should equal \"pine\"');", "assert(/=\\s*myPlants\\[1\\].list\\[1\\]/.test(editor.getValue()), 'message: Use dot and bracket notation to access myPlants');" @@ -4214,7 +4216,7 @@ "description": [ "Modify the contents of a JSON object" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(1===1, 'message: message here');" ], @@ -4249,7 +4251,7 @@ "If value is blank, delete that prop.", "Always return the entire collection object." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "collection = collectionCopy; assert(update(5439, \"artist\", \"ABBA\")[5439][\"artist\"] === \"ABBA\", 'message: After update(5439, \"artist\", \"ABBA\"), artist should be \"ABBA\"');", "update(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After update(2548, \"artist\", \"\"), artist should not be set');", @@ -4478,7 +4480,7 @@ "

Instructions

", "Create a variable total. Use a for loop to add each element of myArr to total." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(total !== 'undefined', 'message: total should be defined');", "assert(total === 20, 'message: total should equal 20');", @@ -4529,7 +4531,7 @@ "

Instructions

", "Modify function multiplyAll so that it multiplies product by each number in the subarrays of arr" ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(multiplyAll([[1],[2],[3]]) === 6, 'message: multiplyAll([[1],[2],[3]]); should return 6');", "assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, 'message: multiplyAll([[1,2],[3,4],[5,6,7]]) should return 5040');", @@ -4612,7 +4614,7 @@ "Write a function which takes a ROT13 encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (IE: spaces, punctiation), but do pass them on.", "The provided code transforms the input into an array for you, codeArr. Place the decoded values into the decodedArr array where the provided code will transform it back into a string." ], - "releasedOn": "11/27/2015", + "releasedOn": "January 1, 2016", "tests": [ "assert(rot13(\"SERR PBQR PNZC\") === \"FREE CODE CAMP\", 'message: rot13(\"SERR PBQR PNZC\") should decode to \"FREE CODE CAMP\"');", "assert(rot13(\"SERR CVMMN!\") === \"FREE PIZZA!\", 'message: rot13(\"SERR CVMMN!\") should decode to \"FREE PIZZA!\"');", @@ -5580,4 +5582,4 @@ "challengeType": "0" } ] -} \ No newline at end of file +} From 8d8c82fd7d8ffb039eb21650ad2b0d5b8bf507a0 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Sun, 27 Dec 2015 16:56:28 -0800 Subject: [PATCH 092/174] Fix missing challengeSeed --- .../basic-javascript.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 726f9d9f62..f0416f30d9 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -16,6 +16,9 @@ "

Instructions

", "Try creating one of each type of comment." ], + "challengeSeed": [ + " " + ], "tests": [ "assert(editor.getValue().match(/(\\/\\/)...../g), 'message: Create a // style comment that contains at least five letters.');", "assert(editor.getValue().match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'message: Create a /* */ style comment that contains at least five letters.');", From 44de5cb468ccb372de60a1376b5501a61b05714e Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 13:26:21 +0530 Subject: [PATCH 093/174] Returning Boolean Values from Functions --- .../basic-javascript.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index f0416f30d9..f8a2e4bfb5 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3359,7 +3359,7 @@ "id": "5679ceb97cbaa8c51670a16b", "title": "Returning Boolean Values from Functions", "description": [ - "You may recall from Comparison with the Equality Operator that all comparison operators return a boolean true or false value.", + "You may recall from Comparison with the Equality Operator that all comparison operators return a boolean true or false value.", "A common anti-pattern is to use an if/else statement to do a comparison and then return true/false:", "
function isEqual(a,b) {
if(a === b) {
return true;
} else {
return false;
}
}
", "Since === returns true or false, we can simply return the result of the comparion:", @@ -3390,7 +3390,9 @@ "" ], "solutions": [ - "" + "function isLess(a, b) {", + " return a < b;", + "}" ], "type": "waypoint", "challengeType": "1", From 9e589a26dbaf462ef57e359954acc6eaa54dd55d Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 19:21:43 +0530 Subject: [PATCH 094/174] Counting Cards --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index f8a2e4bfb5..fd2bbaa16c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3479,8 +3479,8 @@ "", "function cc(card) {", " // Only change code below this line", - "", - "", + " ", + " ", " return \"Change Me\";", " // Only change code above this line", "}", From c05cb8228220323b26050ecc78ade25ad982be7b Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 19:41:21 +0530 Subject: [PATCH 095/174] Build JavaScript Objects --- .../basic-javascript.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index fd2bbaa16c..5336c09437 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3539,7 +3539,8 @@ "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'message: 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), 'message: 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), 'message: 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), 'message: myDog should contain the property friends and it should be an array.');" + "assert((function(z){if(z.hasOwnProperty(\"friends\") && z.friends !== undefined && Array.isArray(z.friends)){return true;}else{return false;}})(myDog), 'message: myDog should contain the property friends and it should be an array.');", + "assert((function(z){return Object.keys(z).length === 4;})(myDog), 'message: myDog should only contain all the given properties.');" ], "challengeSeed": [ "// Example", @@ -3553,10 +3554,10 @@ "// Only change code below this line.", "", "var myDog = {", - "", - "", - "", - "", + " ", + " ", + " ", + " ", "};" ], "tail": [ From 5ad0dc63fa3b546eec5ec9f4819fef95035498e5 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 20:05:56 +0530 Subject: [PATCH 096/174] Accessing Objects Properties with the Dot Operator --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 5336c09437..1c7ec08a87 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3575,7 +3575,7 @@ "description": [ "There are two ways to access the properties of an object: the dot operator (.) and bracket notation ([]), similar to an array.", "The dot operator is what you use when you know the name of the property you're trying to access ahead of time.", - "Here is a sample of using the . to read an object property:", + "Here is a sample of using the dot operator (.) to read an object property:", "
var myObj = {
prop1: \"val1\",
prop2: \"val2\"
};
myObj.prop1; // val1
myObj.prop2; // val2
", "

Instructions

", "Read the values of the properties hat and shirt of testObj using dot notation." From af910d81211b7e51c5736dad10672d904914b626 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 20:14:56 +0530 Subject: [PATCH 097/174] Accessing Objects Properties with Bracket Notation --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 1c7ec08a87..0f3f480198 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3625,9 +3625,9 @@ "id": "56533eb9ac21ba0edf2244c8", "title": "Accessing Objects Properties with Bracket Notation", "description": [ - "The second way to access the properties of an objectis bracket notation ([]). If the property of the object you are trying to access has a space in it, you will need to use bracket notation.", + "The second way to access the properties of an object is bracket notation ([]). If the property of the object you are trying to access has a space in it, you will need to use bracket notation.", "Here is a sample of using bracket notation to read an object property:", - "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", + "
var myObj = {
\"Space Name\": \"Kirk\",
\"More Space\": \"Spock\"
};
myObj[\"Space Name\"]; // Kirk
myObj['More Space']; // Spock
", "Note that property names with spaces in them must be in quotes (single or double).", "

Instructions

", "Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation." From 7732273a72abc72cedfaef05e0a0684b99148e8b Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 20:32:04 +0530 Subject: [PATCH 098/174] Accessing Objects Properties with Variables --- .../basic-javascript.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0f3f480198..0868d86594 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3677,7 +3677,7 @@ "id": "56533eb9ac21ba0edf2244c9", "title": "Accessing Objects Properties with Variables", "description": [ - "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for itterating through lists of object properties or for doing lookups.", + "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for iterating through lists of object properties or for doing lookup.", "Here is an example of using a variable to access a property:", "
var someProp = \"propName\";
var myObj = {
propName: \"Some Value\"
}
myObj[someProp]; // \"Some Value\"
", "Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name", @@ -3708,7 +3708,8 @@ "" ], "solutions": [ - "" + "var playerNumber = 16;", + "var player = testObj[playerNumber];" ], "type": "waypoint", "challengeType": "1", From 7392e694affa997e984c16af5992ca0fbdff8c67 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Sun, 27 Dec 2015 21:02:36 +0530 Subject: [PATCH 099/174] Updating Object Properties --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0868d86594..b0efe89a72 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3728,7 +3728,7 @@ "
var ourDog = {
\"name\": \"Camper\",
\"legs\": 4,
\"tails\": 1,
\"friends\": [\"everything!\"]
};
", "Since he's a particularly happy dog, let's change his name to \"Happy Camper\". Here's how we update his object's name property:", "ourDog.name = \"Happy Camper\"; or", - "outDog[\"name\"] = \"Happy Camper\";", + "ourDog[\"name\"] = \"Happy Camper\";", "Now when we evaluate ourDog.name, instead of getting \"Camper\", we'll get his new name, \"Happy Camper\".", "

Instructions

", "Update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\". You can use either dot or bracket notation." From d9ec45d16a2181d3d74d486261474cd4297ca51a Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 07:37:03 +0530 Subject: [PATCH 100/174] Global vs. Local Scope in Functions remove redundant "a" fix FreeCodeCamp/FreeCodeCamp#5494 --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index b0efe89a72..9f0a841dd8 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2044,7 +2044,7 @@ "id": "56533eb9ac21ba0edf2244c0", "title": "Global vs. Local Scope in Functions", "description": [ - "It is possible to have both a local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.", + "It is possible to have both local and global variables with the same name. When you do this, the local variable takes precedence over the global variable.", "In this example:", "
var someVar = \"Hat\";
function myFun() {
var someVar = \"Head\";
return someVar;
}
", "The function myFun will return \"Head\" because the local version of the variable is present.", From 4b8c077e4866ea8c3fd069227e3c1e2f6044f516 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 07:51:44 +0530 Subject: [PATCH 101/174] Counting Cards Fixed ambiguous wording/"is" vs. "if" fix FreeCodeCamp/FreeCodeCamp#5493 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 9f0a841dd8..bcd184018c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3461,9 +3461,9 @@ "title": "Counting Cards", "description": [ "In the casino game Blackjack, a player can gain an advantage over the house by keeping track of the relative number of high and low cards remaining in the deck. This is called Card Counting. ", - "Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.", + "Having more high cards remaining in the deck favors the player. Each card is assigned a value according to the table below. When the count is positive, the player should bet high. When the count is zero or negative, the player should bet low.", "
ValueCards
+12, 3, 4, 5, 6
07, 8, 9
-110, 'J', 'Q', 'K','A'
", - "You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count if positive, or \"Hold\" if the count is zero or negative.", + "You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return the current count and the string \"Bet\" if the count is positive, or \"Hold\" if the count is zero or negative.", "Example Output", "-3 Hold
5 Bet" ], From 046243b1e9282807c22dbe386a5f91aa9f191bb7 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 08:18:56 +0530 Subject: [PATCH 102/174] Access MultiDimensional Arrays With Indexes Fix FreeCodeCamp/FreeCodeCamp#5492 --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index bcd184018c..98e2b1e00f 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1541,7 +1541,7 @@ "id": "56592a60ddddeae28f7aa8e1", "title": "Access Multi-Dimensional Arrays With Indexes", "description": [ - "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the entries in outer-most array, and each subsequent level of brackets refers to the next level of entry in.", + "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the entries in the outer-most array, and each subsequent level of brackets refers to the next level of entry inside.", "Example", "
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6
arr[3][0][1]; // equals 11
", "

Instructions

", From c7979c89e8328dfbf6f2cb99b55f7c3c0a5d8932 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 08:22:57 +0530 Subject: [PATCH 103/174] Returning Boolean Values from Functions Fix FreeCodeCamp/FreeCodeCamp#5491 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 98e2b1e00f..6a466cd8d3 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3361,8 +3361,8 @@ "description": [ "You may recall from Comparison with the Equality Operator that all comparison operators return a boolean true or false value.", "A common anti-pattern is to use an if/else statement to do a comparison and then return true/false:", - "
function isEqual(a,b) {
if(a === b) {
return true;
} else {
return false;
}
}
", - "Since === returns true or false, we can simply return the result of the comparion:", + "
function isEqual(a,b) {
if(a === b) {
return true;
} else {
return false;
}
}
", + "Since === returns true or false, we can simply return the result of the comparison:", "
function isEqual(a,b) {
return a === b;
}
", "

Instructions

", "Fix the function isLess to remove the if/else statements." From be15836da9919454e4c869e52b7d1b57b2dc2025 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 08:34:20 +0530 Subject: [PATCH 104/174] Concatenating Strings with Plus Operator Fix FreeCodeCamp/FreeCodeCamp#5490 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 6a466cd8d3..217f823774 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -972,7 +972,7 @@ "id": "56533eb9ac21ba0edf2244b7", "title": "Concatenating Strings with Plus Operator", "description": [ - "In JavaScript, the + operator when used with a String value, it is called concatenation operator. You can build a string out of other strings by concatenating them together.", + "In JavaScript, the + operator when used with a String value, it is called a concatenation operator. You can build a string out of other strings by concatenating them together.", "", "'My name is Alan.' + ' And I am able to concatenate.'", "", @@ -982,7 +982,7 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end');", + "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end.');", "assert(editor.getValue().match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" ], "challengeSeed": [ From 57f159f8e9121f93967f20740387461cdad101c8 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 08:44:43 +0530 Subject: [PATCH 105/174] Multiple Identical Options in Switch Statements Fix FreeCodeCamp/FreeCodeCamp#5488 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 217f823774..6736494d6b 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3206,13 +3206,13 @@ "id": "56533eb9ac21ba0edf2244df", "title": "Multiple Identical Options in Switch Statements", "description": [ - "If the break statement is ommitted from a switch statement case, the following case statement(s) are executed unless a break is encountered. If you have mutiple inputs with the same output, you can represent them in a switch statement like this:", + "If the break statement is omitted from a switch statement case, the following case statement(s) are executed unless a break is encountered. If you have multiple inputs with the same output, you can represent them in a switch statement like this:", "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", "Cases for 1, 2, and 3 will all produce the same result.", "

Instructions

", "Write a switch statement to set answer for the following ranges:
1-3 - \"Low\"
4-6 - \"Mid\"
7-9 - \"High\"", "Note", - "You will need to have a case statement for each number in the range." + "You will need to have a case statement for each number in the range." ], "releasedOn": "January 1, 2016", "tests": [ From 09db1f305fa17f9abe06d9c5d71274932b51535f Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 08:53:41 +0530 Subject: [PATCH 106/174] Comparison with the Equality Operator Fix FreeCodeCamp/FreeCodeCamp#5486 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 6736494d6b..2f6cc67c09 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2297,10 +2297,10 @@ "title": "Comparison with the Equality Operator", "description": [ "There are many Comparison Operators in JavaScript. All of these operators return a boolean true or false value.", - "The most basic operator is the equality operator ==. The equality operator compares two values and returns true if they're equivalent or false if they are not. Note that equality is different from assignment (=), which assigns the value at the right of the operator to a variable in the left.", + "The most basic operator is the equality operator ==. The equality operator compares two values and returns true if they're equivalent or false if they are not. Note that equality is different from assignment (=), which assigns the value at the right of the operator to a variable in the left.", "
function equalityTest(myVal) {
if (myVal == 10) {
return \"Equal\";
}
return \"Not Equal\";
}
", "If myVal is equal to 10, the function will return \"Equal\". If it is not, the function will return \"Not Equal\".", - "The equality operator will do it's best to convert values for comparison, for example:", + "The equality operator will do its best to convert values for comparison, for example:", "
1 == 1 // true
\"1\" == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
0 == undefined // false
null == undefined // true
", "

Instructions

", "Add the equality operator to the indicated line so that the function will return \"Equal\" when val is equivalent to 12" From 372ac44491888290e06416c5b8018fda44ba4ac1 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 09:04:23 +0530 Subject: [PATCH 107/174] Declare JavaScript Variables Fix FreeCodeCamp/FreeCodeCamp#5487 --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 2f6cc67c09..60f48e80c1 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -61,7 +61,7 @@ "id": "bd7123c9c443eddfaeb5bdef", "title": "Declare JavaScript Variables", "description": [ - "It's nice to have seven different ways of representing data. But to use them in other parts of code, we must store the data somewhere. In computer science, the placeholder where data is stored for further use is known as variable.", + "It's nice to have seven different ways of representing data. But to use them in other parts of code, we must store the data somewhere. In computer science, the placeholder where data is stored for further use is known as a variable.", "These variables are no different from the x and y variables you use in Maths. Which means they're just a simple name to represent the data we want to refer to.", "Now let's create our first variable and call it \"myName\".", "You'll notice that in myName, we didn't use a space, and that the \"N\" is capitalized. In JavaScript, we write variable names in \"camelCase\".", From f4d927b0e7c20b90928ad8bb4e08ec78f65262f8 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 09:15:13 +0530 Subject: [PATCH 108/174] Understanding Case Sensitivity in Variables Fix FreeCodeCamp/FreeCodeCamp#5483 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 60f48e80c1..c44c3d34a8 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -221,8 +221,8 @@ "id": "56533eb9ac21ba0edf2244ab", "title": "Understanding Case Sensitivity in Variables", "description": [ - "In Javascript all variables and function names are case sensitive. This means that capitalization matters.", - "MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly reccomended that for sake of clarity you do not use this language feature.", + "In JavaScript all variables and function names are case sensitive. This means that capitalization matters.", + "MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you do not use this language feature.", "

Best Practice

Write variable names in Javascript in camelCase. In camelCase, variable names made of multiple words have the first word in all lowercase and the first letter of each subsequent word(s) capitalized.
", " ", "Examples:", From b6e2607e91e60598b57ce7f577d4b98ceb948dba Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Mon, 28 Dec 2015 09:19:28 +0530 Subject: [PATCH 109/174] Understanding Uninitialized Variables Fixes FreeCodeCamp/FreeCodeCamp#5482 --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c44c3d34a8..ce5437833d 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -174,7 +174,7 @@ "id": "56533eb9ac21ba0edf2244aa", "title": "Understanding Uninitialized Variables", "description": [ - "When Javascript variables are declared, they have an inital value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatanate a string with an undefined variable, you will get a literal string of \"undefined\".", + "When JavaScript variables are declared, they have an initial value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means \"Not a Number\". If you concatenate a string with an undefined variable, you will get a literal string of \"undefined\".", "

Instructions

", "Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." ], From e11cbf5a6042cc2480fdf658e5d1abe148e43fb3 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 28 Dec 2015 12:17:06 -0800 Subject: [PATCH 110/174] Fixes for outstanding Basic JS Issues. --- .../basic-javascript.json | 268 +++++++++--------- 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index ce5437833d..bba37ad339 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -20,9 +20,9 @@ " " ], "tests": [ - "assert(editor.getValue().match(/(\\/\\/)...../g), 'message: Create a // style comment that contains at least five letters.');", - "assert(editor.getValue().match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'message: Create a /* */ style comment that contains at least five letters.');", - "assert(editor.getValue().match(/(\\*\\/)/g), 'message: Make sure that you close the comment with a */.');" + "assert(code.match(/(\\/\\/)...../g), 'message: Create a // style comment that contains at least five letters.');", + "assert(code.match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'message: Create a /* */ style comment that contains at least five letters.');", + "assert(code.match(/(\\*\\/)/g), 'message: Make sure that you close the comment with a */.');" ], "type": "waypoint", "challengeType": "1" @@ -103,10 +103,10 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(/var a;/.test(editor.getValue()) && /var b = 2;/.test(editor.getValue()), 'message: Do not change code above the line');", + "assert(/var a;/.test(code) && /var b = 2;/.test(code), 'message: Do not change code above the line');", "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", "assert(typeof b === 'number' && b === 7, 'message: b should have a value of 7');", - "assert(editor.getValue().match(/b\\s*=\\s*a\\s*;/g), 'message: a should be assigned to b with =');" + "assert(code.match(/b\\s*=\\s*a\\s*;/g), 'message: a should be assigned to b with =');" ], "challengeSeed": [ "// Setup", @@ -147,7 +147,7 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(/var\\s+a\\s*=\\s*9\\s*/.test(editor.getValue()), 'message: Initialize a to a value of 9');" + "assert(/var\\s+a\\s*=\\s*9\\s*/.test(code), 'message: Initialize a to a value of 9');" ], "challengeSeed": [ "// Example", @@ -183,7 +183,7 @@ "assert(typeof a === 'number' && a === 6, 'message: a should be defined and have a value of 6');", "assert(typeof b === 'number' && b === 15, 'message: b should be defined and have a value of 15');", "assert(!/undefined/.test(c) && c === \"I am a String!\", 'message: c should not contain undefined and should have a value of \"I am a String!\"');", - "assert(/a = a \\+ 1;/.test(editor.getValue()) && /b = b \\+ 5;/.test(editor.getValue()) && /c = c \\+ \" String!\";/.test(editor.getValue()), 'message: Do not change code below the line');" + "assert(/a = a \\+ 1;/.test(code) && /b = b \\+ 5;/.test(code) && /c = c \\+ \" String!\";/.test(code), 'message: Do not change code below the line');" ], "challengeSeed": [ "// Initialize these three variables", @@ -282,7 +282,7 @@ ], "tests": [ "assert(sum === 20, 'message: sum should equal 20');", - "assert(/\\+/.test(editor.getValue()), 'message: Use the + operator');" + "assert(/\\+/.test(code), 'message: Use the + operator');" ], "challengeSeed": [ "var sum = 10 + 0;", @@ -309,7 +309,7 @@ ], "tests": [ "assert(difference === 12, 'message: Make the variable difference equal 12.');", - "assert(/\\d+\\s*-\\s*\\d+/.test(editor.getValue()),'message: User the - operator');" + "assert(/\\d+\\s*-\\s*\\d+/.test(code),'message: User the - operator');" ], "challengeSeed": [ "var difference = 45 - 0;", @@ -340,7 +340,7 @@ ], "tests": [ "assert(product === 80,'message: Make the variable product equal 80');", - "assert(/\\*/.test(editor.getValue()), 'message: Use the * operator');" + "assert(/\\*/.test(code), 'message: Use the * operator');" ], "challengeSeed": [ "var product = 8 * 0;", @@ -371,7 +371,7 @@ ], "tests": [ "assert(quotient === 2, 'message: Make the variable quotient equal to 2.');", - "assert(/\\d+\\s*\\/\\s*\\d+/.test(editor.getValue()), 'message: Use the / operator');" + "assert(/\\d+\\s*\\/\\s*\\d+/.test(code), 'message: Use the / operator');" ], "challengeSeed": [ "var quotient = 66 / 0;", @@ -398,8 +398,8 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(myVar === 88, 'message: myVar should equal 88');", - "assert(/[+]{2}/.test(editor.getValue()), 'message: Use the ++ operator');", - "assert(/var myVar = 87;/.test(editor.getValue()), 'message: Do not change code above the line');" + "assert(/[+]{2}/.test(code), 'message: Use the ++ operator');", + "assert(/var myVar = 87;/.test(code), 'message: Do not change code above the line');" ], "challengeSeed": [ "var myVar = 87;", @@ -437,8 +437,8 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(myVar === 10, 'message: myVar should equal 10');", - "assert(/myVar[-]{2}/.test(editor.getValue()), 'message: Use the -- operator on myVar');", - "assert(/var myVar = 11;/.test(editor.getValue()), 'message: Do not change code above the line');" + "assert(/myVar[-]{2}/.test(code), 'message: Use the -- operator on myVar');", + "assert(/var myVar = 11;/.test(code), 'message: Do not change code above the line');" ], "challengeSeed": [ "var myVar = 11;", @@ -474,7 +474,7 @@ ], "tests": [ "assert(typeof myDecimal === \"number\", 'message: myDecimal should be a number.');", - "assert(editor.getValue().match(/\\d+\\.\\d+/g).length >= 2, 'message: myDecimal should have a decimal point'); " + "assert(code.match(/\\d+\\.\\d+/g).length >= 2, 'message: myDecimal should have a decimal point'); " ], "challengeSeed": [ "var ourDecimal = 5.7;", @@ -500,7 +500,7 @@ ], "tests": [ "assert(product === 5.0, 'message: The variable product should equal 5.0.');", - "assert(/\\*/.test(editor.getValue()), 'message: You should use the * operator');" + "assert(/\\*/.test(code), 'message: You should use the * operator');" ], "tail": [ "(function(y){return 'product = '+y;})(product);" @@ -523,7 +523,7 @@ ], "tests": [ "assert(quotient === 2.2, 'message: The variable quotient should equal 2.2.');", - "assert(/\\//.test(editor.getValue()), 'message: You should use the / operator');" + "assert(/\\//.test(code), 'message: You should use the / operator');" ], "challengeSeed": [ "var quotient = 0.0 / 2.0;", @@ -544,7 +544,7 @@ "Example", "
5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
", "Usage", - "In mathematics, a number can be checked even or odd by checking the remainder of division of the number by 2. ", + "In mathematics, a number can be checked even or odd by checking the remainder of the division of the number by 2. ", "
17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)
", "Note", "The remainder operator is sometimes incorrectly refered to as the \"modulus\" operator. It is very similar to modulus, but does not work properly with negative numbers.", @@ -554,7 +554,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(remainder === 2, 'message: The value of remainder should be 2');", - "assert(/\\d+\\s*%\\s*\\d+/.test(editor.getValue()), 'message: You should use the % operator');" + "assert(/\\d+\\s*%\\s*\\d+/.test(code), 'message: You should use the % operator');" ], "challengeSeed": [ "// Only change code below this line", @@ -593,8 +593,8 @@ "assert(a === 15, 'message: a should equal 15');", "assert(b === 26, 'message: b should equal 26');", "assert(c === 19, 'message: c should equal 19');", - "assert(editor.getValue().match(/\\+=/g).length === 3, 'message: You should use the += operator for each variable');", - "assert(/var a = 3;/.test(editor.getValue()) && /var b = 17;/.test(editor.getValue()) && /var c = 12;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + "assert(code.match(/\\+=/g).length === 3, 'message: You should use the += operator for each variable');", + "assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code), 'message: Do not modify the code above the line');" ], "challengeSeed": [ "var a = 3;", @@ -644,8 +644,8 @@ "assert(a === 5, 'message: a should equal 5');", "assert(b === -6, 'message: b should equal -6');", "assert(c === 2, 'message: c should equal 2');", - "assert(editor.getValue().match(/-=/g).length === 3, 'message: You should use the -= operator for each variable');", - "assert(/var a = 11;/.test(editor.getValue()) && /var b = 9;/.test(editor.getValue()) && /var c = 3;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + "assert(code.match(/-=/g).length === 3, 'message: You should use the -= operator for each variable');", + "assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), 'message: Do not modify the code above the line');" ], "challengeSeed": [ "var a = 11;", @@ -698,8 +698,8 @@ "assert(a === 25, 'message: a should equal 25');", "assert(b === 36, 'message: b should equal 36');", "assert(c === 46, 'message: c should equal 46');", - "assert(editor.getValue().match(/\\*=/g).length === 3, 'message: You should use the *= operator for each variable');", - "assert(/var a = 5;/.test(editor.getValue()) && /var b = 12;/.test(editor.getValue()) && /var c = 4\\.6;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + "assert(code.match(/\\*=/g).length === 3, 'message: You should use the *= operator for each variable');", + "assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\\.6;/.test(code), 'message: Do not modify the code above the line');" ], "challengeSeed": [ "var a = 5;", @@ -750,8 +750,8 @@ "assert(a === 4, 'message: a should equal 4');", "assert(b === 27, 'message: b should equal 27');", "assert(c === 3, 'message: c should equal 3');", - "assert(editor.getValue().match(/\\/=/g).length === 3, 'message: You should use the /= operator for each variable');", - "assert(/var a = 48;/.test(editor.getValue()) && /var b = 108;/.test(editor.getValue()) && /var c = 33;/.test(editor.getValue()), 'message: Do not modify the code above the line');" + "assert(code.match(/\\/=/g).length === 3, 'message: You should use the /= operator for each variable');", + "assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code), 'message: Do not modify the code above the line');" ], "challengeSeed": [ "var a = 48;", @@ -884,7 +884,7 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(editor.getValue().match(/\\\\\"/g).length === 4 && editor.getValue().match(/[^\\\\]\"/g).length === 2, 'message: You should use two double quotes (") and four escaped double quotes (\") ');" + "assert(code.match(/\\\\\"/g).length === 4 && code.match(/[^\\\\]\"/g).length === 2, 'message: You should use two double quotes (") and four escaped double quotes (\") ');" ], "challengeSeed": [ "var myStr; // Change this line", @@ -915,8 +915,8 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(!/\\\\/g.test(editor.getValue()), 'message: Remove all the backslashes (\\)');", - "assert(editor.getValue().match(/\"/g).length === 4 && editor.getValue().match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "');", + "assert(!/\\\\/g.test(code), 'message: Remove all the backslashes (\\)');", + "assert(code.match(/\"/g).length === 4 && code.match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "');", "assert(myStr === 'Link', 'message: Only remove the backslashes \\ used to escape quotes.');" ], "challengeSeed": [ @@ -972,18 +972,16 @@ "id": "56533eb9ac21ba0edf2244b7", "title": "Concatenating Strings with Plus Operator", "description": [ - "In JavaScript, the + operator when used with a String value, it is called a concatenation operator. You can build a string out of other strings by concatenating them together.", - "", - "'My name is Alan.' + ' And I am able to concatenate.'", - "", + "In JavaScript, when the + operator is used with a String value, it is called the concatenation operator. You can build a new string out of other strings by concatenating them together.", + "Example", + "
'My name is Alan,' + ' I concatenate.'
", "

Instructions

", - "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator.", - "" + "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator." ], "releasedOn": "January 1, 2016", "tests": [ "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end.');", - "assert(editor.getValue().match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" + "assert(code.match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" ], "challengeSeed": [ "// Example", @@ -1012,12 +1010,12 @@ "description": [ "We can also use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.", "

Instructions

", - "Build myStr over several lines by concatenating these two strings:
\"This is the first line. \" and \"This is the second line.\" using the += operator." + "Build myStr over several lines by concatenating these two strings:
\"This is the first sentance. \" and \"This is the second sentance.\" using the += operator." ], "releasedOn": "January 1, 2016", "tests": [ - "assert(myStr === \"This is the first line. This is the second line.\", 'message: myStr should have a value of This is the first line. This is the second line.');", - "assert(editor.getValue().match(/\\w\\s*\\+=\\s*\"/g).length > 1 && editor.getValue().match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" + "assert(myStr === \"This is the first sentance. This is the second sentance.\", 'message: myStr should have a value of This is the first sentance. This is the second sentance.');", + "assert(code.match(/\\w\\s*\\+=\\s*\"/g).length > 1 && code.match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" ], "challengeSeed": [ "// Example", @@ -1031,8 +1029,8 @@ "" ], "solutions": [ - "var myStr = \"This is the first line. \";", - "myStr += \"This is the second line.\";" + "var myStr = \"This is the first sentance. \";", + "myStr += \"This is the second sentance.\";" ], "type": "waypoint", "challengeType": "1", @@ -1053,7 +1051,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(typeof myName !== 'undefined' && myName.length > 2, 'message: myName should be set to a string at least 3 characters long');", - "assert(editor.getValue().match(/\"\\s*\\+\\s*myName\\s*\\+\\s*\"/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" + "assert(code.match(/\"\\s*\\+\\s*myName\\s*\\+\\s*\"/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" ], "challengeSeed": [ "// Example", @@ -1089,7 +1087,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, 'message: someAdjective should be set to a string at least 3 characters long');", - "assert(editor.getValue().match(/\\w\\s*\\+=\\s*someAdjective\\s*;/).length > 0, 'message: Append someAdjective to myStr using the += operator');" + "assert(code.match(/\\w\\s*\\+=\\s*someAdjective\\s*;/).length > 0, 'message: Append someAdjective to myStr using the += operator');" ], "challengeSeed": [ "// Example", @@ -1132,7 +1130,7 @@ ], "tests": [ "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'message: 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;}})(), 'message: You should be getting the length of lastName by using .length like this: lastName.length.');" + "assert((function(){if(code.match(/\\.length/gi) && code.match(/\\.length/gi).length >= 2 && code.match(/var lastNameLength \\= 0;/gi) && code.match(/var lastNameLength \\= 0;/gi).length >= 1){return true;}else{return false;}})(), 'message: You should be getting the length of lastName by using .length like this: lastName.length.');" ], "challengeSeed": [ "// Example", @@ -1171,7 +1169,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;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" + "assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && code.match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" ], "challengeSeed": [ "// Example", @@ -1216,7 +1214,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(myStr === \"Hello World\", 'message: myStr should have a value of Hello World');", - "assert(/myStr = \"Jello World\"/.test(editor.getValue()), 'message: Do not change the code above the line');" + "assert(/myStr = \"Jello World\"/.test(code), 'message: Do not change the code above the line');" ], "tail": [ "(function(v){return \"myStr = \" + v;})(myStr);" @@ -1293,7 +1291,7 @@ ], "tests": [ "assert(lastLetterOfLastName === \"e\", 'message: lastLetterOfLastName should be \"e\".');", - "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use .length to get the last letter.');" + "assert(code.match(/\\.length/g).length === 2, 'message: You have to use .length to get the last letter.');" ], "challengeSeed": [ "// Example", @@ -1331,7 +1329,7 @@ ], "tests": [ "assert(secondToLastLetterOfLastName === 'c', 'message: secondToLastLetterOfLastName should be \"c\".');", - "assert(editor.getValue().match(/\\.length/g).length === 2, 'message: You have to use .length to get the second last letter.');" + "assert(code.match(/\\.length/g).length === 2, 'message: You have to use .length to get the second last letter.');" ], "challengeSeed": [ "// Example", @@ -1513,7 +1511,7 @@ ], "tests": [ "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: myArray should now be [3,2,3].');", - "assert((function(){if(editor.getValue().match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'message: You should be using correct index to modify the value in myArray.');" + "assert((function(){if(code.match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'message: You should be using correct index to modify the value in myArray.');" ], "challengeSeed": [ "// Example", @@ -1541,7 +1539,7 @@ "id": "56592a60ddddeae28f7aa8e1", "title": "Access Multi-Dimensional Arrays With Indexes", "description": [ - "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the entries in the outer-most array, and each subsequent level of brackets refers to the next level of entry inside.", + "One way to think of a multi-dimensional array, is as an array of arrays. When you use brackets to access your array, the first set of bracket refers to the entries in the outer-most array, and each subsequent level of brackets refers to the next level of entries inside.", "Example", "
var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13, 14]
];
arr[0]; // equals [1,2,3]
arr[1][2]; // equals 6
arr[3][0][1]; // equals 11
", "

Instructions

", @@ -1550,7 +1548,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(myData === 8, 'message: myData should be equal to 8.');", - "assert(/myArray\\[2\\]\\[1\\]/g.test(editor.getValue()), 'message: You should be using bracket notation to read the value from myArray.');" + "assert(/myArray\\[2\\]\\[1\\]/g.test(code), 'message: You should be using bracket notation to read the value from myArray.');" ], "challengeSeed": [ "// Setup", @@ -1801,7 +1799,7 @@ "tests": [ "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", "assert(\"Hi World\" === logOutput, 'message: myFunction should output \"Hi World\" to the dev console');", - "assert(/^\\s*myFunction\\(\\)\\s*;/m.test(editor.getValue()), 'message: Call myFunction after you define it');" + "assert(/^\\s*myFunction\\(\\)\\s*;/m.test(code), 'message: Call myFunction after you define it');" ], "challengeSeed": [ "// Example", @@ -1851,7 +1849,8 @@ "id": "56533eb9ac21ba0edf2244bd", "title": "Passing Values to Functions with Arguments", "description": [ - "Functions can take input in the form of parameter. Parameters are variables that take on the value of the arguments which are passed in to the function. Here is a function with two parameters, param1 and param2:", + "Functions can take input with parameters. Parameters are local variables that take on the value of the arguments which are passed into the function. ", + "Here is a function with two parameters, param1 and param2:", "
function testFun(param1, param2) {
console.log(param1, param2);
}
", "Then we can call testFun:", "testFun(\"Hello\", \"World\");", @@ -1864,7 +1863,7 @@ "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", "capture(); myFunction(1,2); uncapture(); assert(logOutput == 3, 'message: myFunction(1,2) should output 3');", "capture(); myFunction(7,9); uncapture(); assert(logOutput == 16, 'message: myFunction(7,9) should output 16');", - "assert(/^\\s*myFunction\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\)\\s*;/m.test(editor.getValue()), 'message: Call myFunction after you define it');" + "assert(/^\\s*myFunction\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\)\\s*;/m.test(code), 'message: Call myFunction after you define it');" ], "head": [ "var logOutput = \"\";", @@ -1927,9 +1926,9 @@ "tests": [ "assert(typeof myGlobal != \"undefined\", 'message: myGlobal should be defined');", "assert(myGlobal === 10, 'message: myGlobal should have a value of 10');", - "assert(/var\\s+myGlobal/.test(editor.getValue()), 'message: myGlobal should be declared using the var keyword');", + "assert(/var\\s+myGlobal/.test(code), 'message: myGlobal should be declared using the var keyword');", "assert(typeof oopsGlobal != \"undefined\" && oopsGlobal === 5, 'message: oopsGlobal should have a value of 5');", - "assert(!/var\\s+oopsGlobal/.test(editor.getValue()), 'message: Do not decalre oopsGlobal using the var keyword');" + "assert(!/var\\s+oopsGlobal/.test(code), 'message: Do not decalre oopsGlobal using the var keyword');" ], "head": [ "var logOutput = \"\";", @@ -2055,7 +2054,7 @@ "tests": [ "assert(outerWear === \"T-Shirt\", 'message: Do not change the value of the global outerWear');", "assert(myFunction() === \"sweater\", 'message: myFunction should return \"sweater\"');", - "assert(/return outerWear/.test(editor.getValue()), 'message: Do not change the return statement');" + "assert(/return outerWear/.test(code), 'message: Do not change the return statement');" ], "challengeSeed": [ "// Setup", @@ -2140,12 +2139,12 @@ "var ourSum = sum(5, 12);", "will call sum function, which returns a value of 17 and assigns it to ourSum variable.", "

Instructions

", - "Call process function with an argument of 7 and assign it's return value to the variable processed." + "Call the process function with an argument of 7 and assign its return value to the variable processed." ], "releasedOn": "January 1, 2016", "tests": [ - "assert(processed === 2, 'message: processed should have a value of 10');", - "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(editor.getValue()), 'message: You should assign process to processed');" + "assert(processed === 2, 'message: processed should have a value of 2');", + "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(code), 'message: You should assign process to processed');" ], "challengeSeed": [ "// Setup", @@ -2160,7 +2159,7 @@ "" ], "tail": [ - "" + "(function(){return \"processed = \" + processed})();" ], "solutions": [ "processed = process(7);" @@ -2310,7 +2309,7 @@ "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", "assert(myTest(12) === \"Equal\", 'message: myTest(12) should return \"Equal\"');", "assert(myTest(\"12\") === \"Equal\", 'message: myTest(\"12\") should return \"Equal\"');", - "assert(editor.getValue().match(/val\\s*==\\s*\\d+/g).length > 0, 'message: You should use the == operator');" + "assert(code.match(/val\\s*==\\s*\\d+/g).length > 0, 'message: You should use the == operator');" ], "challengeSeed": [ "// Setup", @@ -2356,7 +2355,7 @@ "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", "assert(myTest(7) === \"Equal\", 'message: myTest(7) should return \"Equal\"');", "assert(myTest(\"7\") === \"Not Equal\", 'message: myTest(\"7\") should return \"Not Equal\"');", - "assert(editor.getValue().match(/val\\s*===\\s*\\d+/g).length > 0, 'message: You should use the === operator');" + "assert(code.match(/val\\s*===\\s*\\d+/g).length > 0, 'message: You should use the === operator');" ], "challengeSeed": [ "// Setup", @@ -2403,7 +2402,7 @@ "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", "assert(myTest(\"12\") === \"Not Equal\", 'message: myTest(\"12\") should return \"Not Equal\"');", "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", - "assert(editor.getValue().match(/val\\s*!=\\s*\\d+/g).length > 0, 'message: You should use the != operator');" + "assert(code.match(/val\\s*!=\\s*\\d+/g).length > 0, 'message: You should use the != operator');" ], "challengeSeed": [ "// Setup", @@ -2437,7 +2436,7 @@ "id": "56533eb9ac21ba0edf2244d3", "title": "Comparison with the Strict Inequality Operator", "description": [ - "The inequality operator (!==) is the opposite of the strict equality operator. It means \"Strictly Not Equal\" and returns false where strict equality would return true and vice versa. Strict inequality will not convert data types.", + "The strict inequality operator (!==) is the opposite of the strict equality operator. It means \"Strictly Not Equal\" and returns false where strict equality would return true and vice versa. Strict inequality will not convert data types.", "Examples", "
3 !== 3 // false
3 !== '3' // true
4 !== 3 // true
", "

Instructions

", @@ -2449,7 +2448,7 @@ "assert(myTest(\"17\") === \"Not Equal\", 'message: myTest(\"17\") should return \"Not Equal\"');", "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", - "assert(editor.getValue().match(/val\\s*!==\\s*\\d+/g).length > 0, 'message: You should use the !== operator');" + "assert(code.match(/val\\s*!==\\s*\\d+/g).length > 0, 'message: You should use the !== operator');" ], "challengeSeed": [ "// Setup", @@ -2502,7 +2501,7 @@ "assert(myTest(99) === \"Over 10\", 'message: myTest(99) should return \"Over 10\"');", "assert(myTest(100) === \"Over 10\", 'message: myTest(100) should return \"Over 10\"');", "assert(myTest(101) === \"Over 100\", 'message: myTest(101) should return \"Over 100\"');", - "assert(myTest(150) === \"Over 100\", 'message: myTest(150) should return \"Over 100\"');\nassert(editor.getValue().match(/val\\s*>\\s*\\d+/g).length > 1, 'message: You should use the > operator at least twice');" + "assert(myTest(150) === \"Over 100\", 'message: myTest(150) should return \"Over 100\"');\nassert(code.match(/val\\s*>\\s*\\d+/g).length > 1, 'message: You should use the > operator at least twice');" ], "challengeSeed": [ "function myTest(val) {", @@ -2558,7 +2557,7 @@ "assert(myTest(19) === \"10 or Over\", 'message: myTest(19) should return \"10 or Over\"');", "assert(myTest(20) === \"20 or Over\", 'message: myTest(100) should return \"20 or Over\"');", "assert(myTest(21) === \"20 or Over\", 'message: myTest(101) should return \"20 or Over\"');", - "assert(editor.getValue().match(/val\\s*>=\\s*\\d+/g).length > 1, 'message: You should use the >= operator at least twice');" + "assert(code.match(/val\\s*>=\\s*\\d+/g).length > 1, 'message: You should use the >= operator at least twice');" ], "challengeSeed": [ "function myTest(val) {", @@ -2615,7 +2614,7 @@ "assert(myTest(54) === \"Under 55\", 'message: myTest(54) should return \"Under 55\"');", "assert(myTest(55) === \"55 or Over\", 'message: myTest(55) should return \"55 or Over\"');", "assert(myTest(99) === \"55 or Over\", 'message: myTest(99) should return \"55 or Over\"');", - "assert(editor.getValue().match(/val\\s*<\\s*\\d+/g).length > 1, 'message: You should use the < operator at least twice');" + "assert(code.match(/val\\s*<\\s*\\d+/g).length > 1, 'message: You should use the < operator at least twice');" ], "challengeSeed": [ "function myTest(val) {", @@ -2658,7 +2657,7 @@ "id": "56533eb9ac21ba0edf2244d7", "title": "Comparison with the Less Than Equal To Operator", "description": [ - "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equl the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", + "The less than equal to operator (<=) compares the values of two numbers. If the number to the left is less than or equal the number to the right, it returns true. If the number on the left is greater than the number on the right, it returns false. Like the equality operator, less than equal to converts data types.", "Examples", "
4 <= 5 // true
'7' <= 7 // true
5 <= 5 // true
3 <= 2 // false
'8' <= 4 // false
", "

Instructions

", @@ -2673,7 +2672,7 @@ "assert(myTest(24) === \"Smaller Than or Equal to 24\", 'message: myTest(24) should return \"Smaller Than or Equal to 24\"');", "assert(myTest(25) === \"25 or More\", 'message: myTest(25) should return \"25 or More\"');", "assert(myTest(55) === \"25 or More\", 'message: myTest(55) should return \"25 or More\"');", - "assert(editor.getValue().match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <= operator at least twice');" + "assert(code.match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <= operator at least twice');" ], "challengeSeed": [ "function myTest(val) {", @@ -2727,8 +2726,8 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(editor.getValue().match(/&&/g).length === 1, 'message: You should use the && operator once');", - "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(code.match(/&&/g).length === 1, 'message: You should use the && operator once');", + "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", "assert(myTest(0) === \"No\", 'message: myTest(0) should return \"No\"');", "assert(myTest(24) === \"No\", 'message: myTest(24) should return \"No\"');", "assert(myTest(25) === \"Yes\", 'message: myTest(25) should return \"Yes\"');", @@ -2775,7 +2774,7 @@ "id": "56533eb9ac21ba0edf2244d9", "title": "Comparisons with the Logical Or Operator", "description": [ - "The logical or operator (||) returns true if either ofoperands is true. Otherwise, it returns false.", + "The logical or operator (||) returns true if either of the operands is true. Otherwise, it returns false.", "The pattern below should look familiar from prior waypoints:", "
if (num > 10) {
return \"No\";
}
if (num < 5) {
return \"No\";
}
return \"Yes\";
", "will return \"Yes\" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:", @@ -2785,8 +2784,8 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(editor.getValue().match(/\\|\\|/g).length === 1, 'message: You should use the || operator once');", - "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(code.match(/\\|\\|/g).length === 1, 'message: You should use the || operator once');", + "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", "assert(myTest(0) === \"Outside\", 'message: myTest(0) should return \"Outside\"');", "assert(myTest(9) === \"Outside\", 'message: myTest(9) should return \"Outside\"');", "assert(myTest(10) === \"Inside\", 'message: myTest(10) should return \"Inside\"');", @@ -2842,13 +2841,13 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(editor.getValue().match(/if/g).length === 1, 'message: You should only have one if statement');", - "assert(/else/g.test(editor.getValue()), 'message: You should use an else statement');", + "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(/else/g.test(code), 'message: You should use an else statement');", "assert(myTest(4) === \"5 or Smaller\", 'message: myTest(4) should return \"5 or Smaller\"');", "assert(myTest(5) === \"5 or Smaller\", 'message: myTest(5) should return \"5 or Smaller\"');", "assert(myTest(6) === \"Bigger than 5\", 'message: myTest(6) should return \"Bigger than 5\"');", "assert(myTest(10) === \"Bigger than 5\", 'message: myTest(10) should return \"Bigger than 5\"');", - "assert(/var result = \"\";/.test(editor.getValue()) && /return result;/.test(editor.getValue()), 'message: Do not change the code above or below the lines.');" + "assert(/var result = \"\";/.test(code) && /return result;/.test(code), 'message: Do not change the code above or below the lines.');" ], "challengeSeed": [ "function myTest(val) {", @@ -2900,8 +2899,8 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(editor.getValue().match(/else/g).length > 1, 'message: You should have at least two else statements');", - "assert(editor.getValue().match(/if/g).length > 1, 'message: You should have at least two if statements');", + "assert(code.match(/else/g).length > 1, 'message: You should have at least two else statements');", + "assert(code.match(/if/g).length > 1, 'message: You should have at least two if statements');", "assert(myTest(0) === \"Smaller than 5\", 'message: myTest(4) should return \"Smaller than 5\"');", "assert(myTest(5) === \"Between 5 and 10\", 'message: myTest(5) should return \"Smaller than 5\"');", "assert(myTest(7) === \"Between 5 and 10\", 'message: myTest(7) should return \"Between 5 and 10\"');", @@ -2946,9 +2945,9 @@ }, { "id": "56533eb9ac21ba0edf2244dc", - "title": "Chaining If/Else Statements", + "title": "Chaining If Else Statements", "description": [ - "if...else statements can be chained together for complex logic. Here is pseudocode of multiple chained if / else if statements:", + "if/else statements can be chained together for complex logic. Here is pseudocode of multiple chained if / else if statements:", "
if(condition1) {
statement1
} else if (condition1) {
statement1
} else if (condition3) {
statement3
. . .
} else {
statementN
}
", "

Instructions

", "Write chained if/else if statements to fulfill the following conditions:", @@ -2956,9 +2955,9 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(editor.getValue().match(/else/g).length > 3, 'message: You should have at least four else statements');", - "assert(editor.getValue().match(/if/g).length > 3, 'message: You should have at least four if statements');", - "assert(editor.getValue().match(/return/g).length === 5, 'message: You should have five return statements');", + "assert(code.match(/else/g).length > 3, 'message: You should have at least four else statements');", + "assert(code.match(/if/g).length > 3, 'message: You should have at least four if statements');", + "assert(code.match(/return/g).length === 5, 'message: You should have five return statements');", "assert(myTest(0) === \"Tiny\", 'message: myTest(0) should return \"Tiny\"');", "assert(myTest(4) === \"Tiny\", 'message: myTest(4) should return \"Tiny\"');", "assert(myTest(5) === \"Small\", 'message: myTest(5) should return \"Small\"');", @@ -3081,11 +3080,12 @@ "id": "56533eb9ac21ba0edf2244dd", "title": "Selecting from many options with Switch Statements", "description": [ - "If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which defines various possible values. Statements are executed from the first matched case value unless a break is encountered. Shown here in pseudocode:", + "If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which defines various possible values. Statements are executed from the first matched case value until a break is encountered. ", + "Here is a pseudocode example:", "
switch (num) {
case value1:
statement1;
break;
case value2:
statement2;
break;
...
case valueN:
statementN;
break;
}
", "case values are tested with strict equality (===). The break tells JavaScript to stop executing statements. If the break is omitted, the next statement will be executed.", "

Instructions

", - "Write a switch statement to set answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" + "Write a switch statement which tests val and sets answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" ], "releasedOn": "January 1, 2016", "tests": [ @@ -3093,8 +3093,8 @@ "assert(myTest(2) === \"beta\", 'message: myTest(2) should have a value of \"beta\"');", "assert(myTest(3) === \"gamma\", 'message: myTest(3) should have a value of \"gamma\"');", "assert(myTest(4) === \"delta\", 'message: myTest(4) should have a value of \"delta\"');", - "assert(!/else/g.test(editor.getValue()) || !/if/g.test(editor.getValue()), 'message: You should not use any if or else statements');", - "assert(editor.getValue().match(/break/g).length > 2, 'message: You should have at least 3 break statements');" + "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", + "assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break statements');" ], "challengeSeed": [ "function myTest(val) {", @@ -3143,7 +3143,7 @@ "id": "56533eb9ac21ba0edf2244de", "title": "Adding a default option in Switch statements", "description": [ - "In a switch statement you may not be able to specify all possible values as case statements. Instead, you can add the default statement which will be executed if no matching case are found. Think of it like the final else statement in an if...else chain.", + "In a switch statement you may not be able to specify all possible values as case statements. Instead, you can add the default statement which will be executed if no matching case statements are found. Think of it like the final else statement in an if/else chain.", "A default statement should be the last case.", "
switch (num) {
case value1:
statement1
break;
case value2:
statement2;
break;
...
default:
defaultStatement;
}
", "

Instructions

", @@ -3156,8 +3156,8 @@ "assert(myTest(\"c\") === \"cat\", 'message: myTest(\"c\") should have a value of \"cat\"');", "assert(myTest(\"d\") === \"stuff\", 'message: myTest(\"d\") should have a value of \"stuff\"');", "assert(myTest(4) === \"stuff\", 'message: myTest(4) should have a value of \"stuff\"');", - "assert(!/else/g.test(editor.getValue()) || !/if/g.test(editor.getValue()), 'message: You should not use any if or else statements');", - "assert(editor.getValue().match(/break/g).length > 2, 'message: You should have at least 3 break statements');" + "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", + "assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break statements');" ], "challengeSeed": [ "function myTest(val) {", @@ -3206,7 +3206,7 @@ "id": "56533eb9ac21ba0edf2244df", "title": "Multiple Identical Options in Switch Statements", "description": [ - "If the break statement is omitted from a switch statement case, the following case statement(s) are executed unless a break is encountered. If you have multiple inputs with the same output, you can represent them in a switch statement like this:", + "If the break statement is ommitted from a switch statement's case, the following case statement(s) are executed until a break is encountered. If you have multiple inputs with the same output, you can represent them in a switch statement like this:", "
switch(val) {
case 1:
case 2:
case 3:
result = \"1, 2, or 3\";
break;
case 4:
result = \"4 alone\";
}
", "Cases for 1, 2, and 3 will all produce the same result.", "

Instructions

", @@ -3225,8 +3225,8 @@ "assert(myTest(7) === \"High\", 'message: myTest(7) should return \"High\"');", "assert(myTest(8) === \"High\", 'message: myTest(8) should return \"High\"');", "assert(myTest(9) === \"High\", 'message: myTest(9) should return \"High\"');", - "assert(!/else/g.test(editor.getValue()) || !/if/g.test(editor.getValue()), 'message: You should not use any if or else statements');", - "assert(editor.getValue().match(/case/g).length === 9, 'message: You should have nine case statements');" + "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", + "assert(code.match(/case/g).length === 9, 'message: You should have nine case statements');" ], "challengeSeed": [ "function myTest(val) {", @@ -3277,7 +3277,7 @@ }, { "id": "56533eb9ac21ba0edf2244e0", - "title": "Replacing If/Else chains with Switch", + "title": "Replacing If Else chains with Switch", "description": [ "If you have many options to choose from, a switch statement can be easier to write than many chained if/if else statements. The following:", "
if(val === 1) {
answer = \"a\";
} else if(val === 2) {
answer = \"b\";
} else {
answer = \"c\";
}
", @@ -3288,9 +3288,9 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(!/else/g.test(editor.getValue()), 'message: You should not use any else statements');", - "assert(!/if/g.test(editor.getValue()), 'message: You should not use any if statements');", - "assert(editor.getValue().match(/break/g).length === 4, 'message: You should have four break statements');", + "assert(!/else/g.test(code), 'message: You should not use any else statements');", + "assert(!/if/g.test(code), 'message: You should not use any if statements');", + "assert(code.match(/break/g).length === 4, 'message: You should have four break statements');", "assert(myTest(\"bob\") === \"Marley\", 'message: myTest(\"bob\") should be \"Marley\"');", "assert(myTest(42) === \"The Answer\", 'message: myTest(42) should be \"The Answer\"');", "assert(myTest(1) === \"There is no #1\", 'message: myTest(1) should be \"There is no #1\"');", @@ -3371,7 +3371,7 @@ "tests": [ "assert(isLess(10,15) === true, 'message: isLess(10,15) should return true');", "assert(isLess(15, 10) === false, 'message: isLess(15,10) should return true');", - "assert(!/if|else/g.test(editor.getValue()), 'message: You should not use any if or else statements');" + "assert(!/if|else/g.test(code), 'message: You should not use any if or else statements');" ], "challengeSeed": [ "function isLess(a, b) {", @@ -3585,7 +3585,7 @@ "assert(typeof hatValue === 'string' , 'message: hatValue should be a string');", "assert(hatValue === 'ballcap' , 'message: The value of hatValue should be \"ballcap\"');", "assert(typeof shirtValue === 'string' , 'message: shirtValue should be a string');", - "assert(shirtValue === 'jersey' , 'message: The value of shirtValue should be \"jersey\"');\nassert(editor.getValue().match(/testObj\\.\\w+/g).length > 1, 'message: You should use dot notation twice');" + "assert(shirtValue === 'jersey' , 'message: The value of shirtValue should be \"jersey\"');\nassert(code.match(/testObj\\.\\w+/g).length > 1, 'message: You should use dot notation twice');" ], "challengeSeed": [ "// Setup", @@ -3638,7 +3638,7 @@ "assert(entreeValue === 'hamburger' , 'message: The value of entreeValue should be \"hamburger\"');", "assert(typeof drinkValue === 'string' , 'message: drinkValue should be a string');", "assert(drinkValue === 'water' , 'message: The value of drinkValue should be \"water\"');", - "assert(editor.getValue().match(/testObj\\[('|\")[^'\"]+\\1\\]/g).length > 1, 'message: You should use bracket notation twice');" + "assert(code.match(/testObj\\[('|\")[^'\"]+\\1\\]/g).length > 1, 'message: You should use bracket notation twice');" ], "challengeSeed": [ "// Setup", @@ -3689,7 +3689,7 @@ "assert(typeof playerNumber === 'number', 'message: playerNumber should be a number');", "assert(typeof player === 'string', 'message: The variable player should be a string');", "assert(player === 'Montana', 'message: The value of player should be \"Montana\"');", - "assert(/testObj\\[\\s*playerNumber\\s*\\]/.test(editor.getValue()),'message: You should use bracket notation to access testObj');" + "assert(/testObj\\[\\s*playerNumber\\s*\\]/.test(code),'message: You should use bracket notation to access testObj');" ], "challengeSeed": [ "// Setup", @@ -3735,7 +3735,7 @@ ], "tests": [ "assert(/happy coder/gi.test(myDog.name), 'message: Update myDog's \"name\" property to equal \"Happy Coder\".');", - "assert(/\"name\": \"Coder\"/.test(editor.getValue()), 'message: Do not edit the myDog definition');" + "assert(/\"name\": \"Coder\"/.test(code), 'message: Do not edit the myDog definition');" ], "challengeSeed": [ "// Example", @@ -3781,7 +3781,7 @@ ], "tests": [ "assert(myDog.bark !== undefined, 'message: Add the property \"bark\" to myDog.');", - "assert(!/bark[^\\n]:/.test(editor.getValue()), 'message: Do not add \"bark\" to the setup section');" + "assert(!/bark[^\\n]:/.test(code), 'message: Do not add \"bark\" to the setup section');" ], "challengeSeed": [ "// Example", @@ -3831,7 +3831,7 @@ ], "tests": [ "assert(myDog.tails === undefined, 'message: Delete the property \"tails\" from myDog.');", - "assert(editor.getValue().match(/\"tails\": 1/g).length > 1, 'message: Do not modify the myDog setup');" + "assert(code.match(/\"tails\": 1/g).length > 1, 'message: Do not modify the myDog setup');" ], "challengeSeed": [ "// Example", @@ -3879,9 +3879,9 @@ "id": "56533eb9ac21ba0edf2244ca", "title": "Using Objects for Lookups", "description": [ - "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if...else chain. This is most useful when you know that your input data is limited to a certain range.", + "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.", "Here is an example of a simple reverse alphabet lookup:", - "
var alpha = {
1:\"Z\"
2:\"Y\"
3:\"X\"
...
4:\"W\"
24:\"C\"
25:\"B\"
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", + "
var alpha = {
1:\"Z\",
2:\"Y\",
3:\"X\",
...
4:\"W\",
24:\"C\",
25:\"B\",
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", "

Instructions

", "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." ], @@ -3897,7 +3897,7 @@ "assert(numberLookup(7) === 'seven', 'message: numberLookup(7) should equal \"seven\"');", "assert(numberLookup(8) === 'eight', 'message: numberLookup(8) should equal \"eight\"');", "assert(numberLookup(9) === 'nine', 'message: numberLookup(9) should equal \"nine\"');", - "assert(!/case|switch|if/g.test(editor.getValue()), 'message: You should not use case, switch, or if statements');" + "assert(!/case|switch|if/g.test(code), 'message: You should not use case, switch, or if statements');" ], "challengeSeed": [ "// Setup", @@ -3977,11 +3977,11 @@ "id": "567af2437cbaa8c51670a16c", "title": "Testing Objects for Properties", "description": [ - "Sometimes it is useful to check of the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.", + "Sometimes it is useful to check if the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.", "Example", "
var myObj = {
top: \"hat\",
bottom: \"pants\"
};
myObj.hasOwnProperty(\"hat\"); // true
myObj.hasOwnProperty(\"middle\"); // false
", "

Instructions

", - " Modify function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not return \"Not Found\"." + "Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return \"Not Found\"." ], "releasedOn": "January 1, 2016", "tests": [ @@ -4047,7 +4047,7 @@ "assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string', 'message: myMusic[1] should contain a title property which is a string');", "assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number', 'message: myMusic[1] should contain a release_year property which is a number');", "assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats), 'message: myMusic[1] should contain a formats property which is an array');", - "assert(typeof myMusic[1].formats[0] === 'string' && myMusic[1].formats.length > 1, 'message: formats should be an array of strings with at least two elements');" + "assert(myMusic[1].formats.every(function(item) { return (typeof item === \"string\")}) && myMusic[1].formats.length > 1, 'message: formats should be an array of strings with at least two elements');" ], "challengeSeed": [ "var myMusic = [", @@ -4116,7 +4116,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(gloveBoxContents === \"maps\", 'message: gloveBoxContents should equal \"maps\"');", - "assert(/=\\s*myStorage\\.car\\.inside\\[([\"'])glove box\\1\\]/.test(editor.getValue()), 'message: Use dot and bracket notation to access myStorage');" + "assert(/=\\s*myStorage\\.car\\.inside\\[([\"'])glove box\\1\\]/.test(code), 'message: Use dot and bracket notation to access myStorage');" ], "challengeSeed": [ "// Setup", @@ -4175,7 +4175,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(secondTree === \"pine\", 'message: secondTree should equal \"pine\"');", - "assert(/=\\s*myPlants\\[1\\].list\\[1\\]/.test(editor.getValue()), 'message: Use dot and bracket notation to access myPlants');" + "assert(/=\\s*myPlants\\[1\\].list\\[1\\]/.test(code), 'message: Use dot and bracket notation to access myPlants');" ], "challengeSeed": [ "// Setup", @@ -4250,7 +4250,7 @@ "id": "56533eb9ac21ba0edf2244cf", "title": "Record Collection", "description": [ - "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and which has several properties. Not all albums have complete information.", + "You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and has several properties. Not all albums have complete information.", "Write a function which takes an id, a property (prop), and a value.", "For the given id in collection:", "If value is non-blank (value !== \"\"), then update or set the value for the prop.", @@ -4379,7 +4379,7 @@ "Use a for loop to work to push the values 1 through 5 onto myArray." ], "tests": [ - "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", + "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", "assert.deepEqual(myArray, [1,2,3,4,5], 'message: myArray should equal [1,2,3,4,5].');" ], "challengeSeed": [ @@ -4416,7 +4416,7 @@ "Push the odd numbers from 1 through 9 to myArray using a for loop." ], "tests": [ - "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", + "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", "assert.deepEqual(myArray, [1,3,5,7,9], 'message: myArray should equal [1,3,5,7,9].');" ], "challengeSeed": [ @@ -4454,7 +4454,7 @@ "Push the odd numbers from 9 through 1 to myArray using a for loop." ], "tests": [ - "assert(editor.getValue().match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", + "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", "assert.deepEqual(myArray, [9,7,5,3,1], 'message: myArray should equal [9,7,5,3,1].');" ], "challengeSeed": [ @@ -4491,7 +4491,7 @@ "tests": [ "assert(total !== 'undefined', 'message: total should be defined');", "assert(total === 20, 'message: total should equal 20');", - "assert(!/20/.test(editor.getValue()), 'message: Do not set total to 20 directly');" + "assert(!/20/.test(code), 'message: Do not set total to 20 directly');" ], "challengeSeed": [ "// Example", @@ -4595,7 +4595,7 @@ "Push the numbers 0 through 4 to myArray using a while loop." ], "tests": [ - "assert(editor.getValue().match(/while/g), 'message: You should be using a while loop for this.');", + "assert(code.match(/while/g), 'message: You should be using a while loop for this.');", "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray should equal [0,1,2,3,4].');" ], "challengeSeed": [ @@ -4618,7 +4618,7 @@ "description": [ "One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount. ", "A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.", - "Write a function which takes a ROT13 encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (IE: spaces, punctiation), but do pass them on.", + "Write a function which takes a ROT13 encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.", "The provided code transforms the input into an array for you, codeArr. Place the decoded values into the decodedArr array where the provided code will transform it back into a string." ], "releasedOn": "January 1, 2016", @@ -4693,7 +4693,7 @@ "tests": [ "assert(typeof(myFunction()) === \"number\", 'message: myFunction should return a random number.');", "assert((myFunction()+''). match(/\\./g), 'message: The number returned by myFunction should be a decimal.');", - "assert(editor.getValue().match(/Math\\.random/g).length >= 0, 'message: You should be using Math.random to generate the random decimal number.');" + "assert(code.match(/Math\\.random/g).length >= 0, 'message: You should be using Math.random to generate the random decimal number.');" ], "challengeSeed": [ "function myFunction() {", @@ -4728,9 +4728,9 @@ ], "tests": [ "assert(typeof(myFunction()) === \"number\" && (function(){var r = myFunction();return Math.floor(r) === r;})(), 'message: The result of myFunction should be a whole number.');", - "assert(editor.getValue().match(/Math.random/g).length > 1, 'message: You should be using Math.random to generate 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), 'message: You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine.');", - "assert(editor.getValue().match(/Math.floor/g).length > 1, 'message: You should use Math.floor to remove the decimal part of the number.');" + "assert(code.match(/Math.random/g).length > 1, 'message: You should be using Math.random to generate a random number.');", + "assert(code.match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || code.match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'message: You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine.');", + "assert(code.match(/Math.floor/g).length > 1, 'message: You should use Math.floor to remove the decimal part of the number.');" ], "challengeSeed": [ "var randomNumberBetween0and19 = Math.floor(Math.random() * 20);", @@ -4763,7 +4763,7 @@ "assert(myFunction() >= myMin, 'message: The random number generated by myFunction should be greater than or equal to your minimum number, myMin.');", "assert(myFunction() <= myMax, 'message: The random number generated by myFunction should be less than or equal to your maximum number, myMax.');", "assert(myFunction() % 1 === 0 , 'message: The random number generated by myFunction should be an integer, not a decimal.');", - "assert((function(){if(editor.getValue().match(/myMax/g).length > 1 && editor.getValue().match(/myMin/g).length > 2 && editor.getValue().match(/Math.floor/g) && editor.getValue().match(/Math.random/g)){return true;}else{return false;}})(), 'message: myFunction() should use use both myMax and myMin, and return a random number in your range.');" + "assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), 'message: myFunction() should use use both myMax and myMin, and return a random number in your range.');" ], "challengeSeed": [ "var ourMin = 1;", @@ -4810,7 +4810,7 @@ ], "tests": [ "assert(test==2, 'message: Your regular expression should find two occurrences of the word and.');", - "assert(editor.getValue().match(/\\/and\\/gi/), 'message: Use regular expressions to find the word and in testString.');" + "assert(code.match(/\\/and\\/gi/), 'message: Use regular expressions to find the word and in testString.');" ], "head": [ "" @@ -4847,7 +4847,7 @@ "Use the \\d selector to select the number of numbers in the string, allowing for the possibility of multi-digit numbers." ], "tests": [ - "assert(editor.getValue().match(/\\/\\\\d\\+\\//g), 'message: Use the /\\d+/g regular expression to find the numbers in testString.');", + "assert(code.match(/\\/\\\\d\\+\\//g), 'message: Use the /\\d+/g regular expression to find the numbers in testString.');", "assert(test === 2, 'message: Your regular expression should find two numbers in testString.');" ], "head": [ @@ -4881,7 +4881,7 @@ "Use it to select all the whitespace characters in the sentence string." ], "tests": [ - "assert(editor.getValue().match(/\\/\\\\s\\+\\//g), 'message: Use the /\\s+/g regular expression to find the spaces in testString.');", + "assert(code.match(/\\/\\\\s\\+\\//g), 'message: Use the /\\s+/g regular expression to find the spaces in testString.');", "assert(test === 7, 'message: Your regular expression should find seven spaces in testString.');" ], "head": [ @@ -4912,7 +4912,7 @@ "Use /\\S/g to count the number of non-whitespace characters in testString." ], "tests": [ - "assert(editor.getValue().match(/\\/\\\\S\\/g/g), 'message: Use the /\\S/g regular expression to find non-space characters in testString.');", + "assert(code.match(/\\/\\\\S\\/g/g), 'message: Use the /\\S/g regular expression to find non-space characters in testString.');", "assert(test === 49, 'message: Your regular expression should find forty nine non-space characters in the testString.');" ], "head": [ @@ -5589,4 +5589,4 @@ "challengeType": "0" } ] -} +} \ No newline at end of file From 62f1f57b922650fb49e256dcab099ef05ab8dbc2 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 28 Dec 2015 14:08:11 -0800 Subject: [PATCH 111/174] Fix Else If statement and chains closes #5489 closes #5489 --- .../basic-javascript.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index bba37ad339..bb297ee4d7 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2895,7 +2895,8 @@ "description": [ "If you have multiple conditions that need to be addressed, you can chain if statements together with else if statements.", "
if (num > 15) {
return \"Bigger then 15\";
} else if (num < 5) {
return \"Smaller than 5\";
} else {
return \"Between 5 and 15\";
}
", - "

Instructions

Convert the logic to use else if statements." + "

Instructions

", + "Convert the logic to use else if statements." ], "releasedOn": "January 1, 2016", "tests": [ @@ -3277,7 +3278,7 @@ }, { "id": "56533eb9ac21ba0edf2244e0", - "title": "Replacing If Else chains with Switch", + "title": "Replacing If Else Chains with Switch", "description": [ "If you have many options to choose from, a switch statement can be easier to write than many chained if/if else statements. The following:", "
if(val === 1) {
answer = \"a\";
} else if(val === 2) {
answer = \"b\";
} else {
answer = \"c\";
}
", From 41d78b588085774d91ff41c411e98f8ba1c6ddcd Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Tue, 29 Dec 2015 04:49:09 +0530 Subject: [PATCH 112/174] Using Objects for Lookups --- .../basic-javascript.json | 84 ++++++++----------- 1 file changed, 33 insertions(+), 51 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index bb297ee4d7..c8fff7b122 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3888,83 +3888,65 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "assert(numberLookup(0) === 'zero', 'message: numberLookup(0) should equal \"zero\"');", - "assert(numberLookup(1) === 'one', 'message: numberLookup(1) should equal \"one\"');", - "assert(numberLookup(2) === 'two', 'message: numberLookup(2) should equal \"two\"');", - "assert(numberLookup(3) === 'three', 'message: numberLookup(3) should equal \"three\"');", - "assert(numberLookup(4) === 'four', 'message: numberLookup(4) should equal \"four\"');", - "assert(numberLookup(5) === 'five', 'message: numberLookup(5) should equal \"five\"');", - "assert(numberLookup(6) === 'six', 'message: numberLookup(6) should equal \"six\"');", - "assert(numberLookup(7) === 'seven', 'message: numberLookup(7) should equal \"seven\"');", - "assert(numberLookup(8) === 'eight', 'message: numberLookup(8) should equal \"eight\"');", - "assert(numberLookup(9) === 'nine', 'message: numberLookup(9) should equal \"nine\"');", - "assert(!/case|switch|if/g.test(code), 'message: You should not use case, switch, or if statements');" + "assert(phoneticLookup(\"alpha\") === 'Adams', 'message: phoneticLookup(\"alpha\") should equal \"Adams\"');", + "assert(phoneticLookup(\"bravo\") === 'Boston', 'message: phoneticLookup(\"bravo\") should equal \"Boston\"');", + "assert(phoneticLookup(\"charlie\") === 'Chicago', 'message: phoneticLookup(\"charlie\") should equal \"Chicago\"');", + "assert(phoneticLookup(\"delta\") === 'Denver', 'message: phoneticLookup(\"delta\") should equal \"Denver\"');", + "assert(phoneticLookup(\"echo\") === 'Easy', 'message: phoneticLookup(\"echo\") should equal \"Easy\"');", + "assert(phoneticLookup(\"foxtrot\") === 'Frank', 'message: phoneticLookup(\"foxtrot\") should equal \"Frank\"');", + "assert(typeof phoneticLookup(\"\") === 'undefined', 'message: phoneticLookup(\"\") should equal undefined');", + "assert(!/case|switch|if/g.test(editor.getValue()), 'message: You should not use case, switch, or if statements'); " ], "challengeSeed": [ "// Setup", - "function numberLookup(val) {", + "function phoneticLookup(val) {", " var result = \"\";", "", " // Only change code below this line", " switch(val) {", - " case 0: ", - " result = \"zero\";", + " case \"alpha\": ", + " result = \"Adams\";", " break;", - " case 1: ", - " result = \"one\";", + " case \"bravo\": ", + " result = \"Boston\";", " break;", - " case 2: ", - " result = \"two\";", + " case \"charlie\": ", + " result = \"Chicago\";", " break;", - " case 3: ", - " result = \"three\";", + " case \"delta\": ", + " result = \"Denver\";", " break;", - " case 4: ", - " result = \"four\";", - " break;", - " case 5: ", - " result = \"five\";", - " break;", - " case 6: ", - " result = \"six\";", - " break;", - " case 7: ", - " result = \"seven\";", - " break;", - " case 8: ", - " result = \"eight\";", - " break;", - " case 9: ", - " result = \"nine\";", + " case \"echo\": ", + " result = \"Easy\";", " break;", + " case \"foxtrot\": ", + " result = \"Frank\";", " }", "", " // Only change code above this line", " return result;", "}", - "", "" ], "solutions": [ - "function numberLookup(val) {", + "function phoneticLookup(val) {", " var result = \"\";", "", " var lookup = {", - " 0:\"zero\",", - " 1:\"one\",", - " 2:\"two\",", - " 3:\"three\",", - " 4:\"four\",", - " 5:\"five\",", - " 6:\"six\",", - " 7:\"seven\",", - " 8:\"eight\",", - " 9:\"nine\"", + " alpha: \"Adams\",", + " bravo: \"Boston\",", + " charlie: \"Chicago\",", + " delta: \"Denver\",", + " echo: \"Easy\",", + " foxtrot: \"Frank\"", " };", + "", " result = lookup[val];", "", - " return result;", - "}" + " return result;", + "}", + "", + "phoneticLookup(\"charlie\");" ], "type": "waypoint", "challengeType": "1", From ebce4bbf7e73d995af2fc42a33070fc82383180e Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 28 Dec 2015 21:15:50 -0800 Subject: [PATCH 113/174] Unmunged Solutions --- .../basic-javascript.json | 650 ++---------------- 1 file changed, 67 insertions(+), 583 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c8fff7b122..2d9453587f 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -120,10 +120,7 @@ "(function(a,b){return \"a = \" + a + \", b = \" + b;})(a,b);" ], "solutions": [ - "var a;", - "var b = 2;", - "a = 7;", - "b = a;" + "var a;\nvar b = 2;\na = 7;\nb = a;" ], "type": "waypoint", "challengeType": "1", @@ -202,12 +199,7 @@ "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" ], "solutions": [ - "var a = 5;", - "var b = 10;", - "var c = \"I am a\";", - "a = a + 1;", - "b = b + 5;", - "c = c + \" String!\";" + "var a = 5;\nvar b = 10;\nvar c = \"I am a\";\na = a + 1;\nb = b + 5;\nc = c + \" String!\";" ], "type": "waypoint", "challengeType": "1", @@ -250,13 +242,7 @@ "" ], "solutions": [ - "var StUdLyCapVaR;", - "var properCamelCase;", - "var TitleCase;", - "", - "StUdLyCapVaR = 10;", - "properCamelCase = \"A String\";", - "TitleCaseOver = \"9000\";" + "var StUdLyCapVaR;\nvar properCamelCase;\nvar TitleCase;\n\nStUdLyCapVaR = 10;\nproperCamelCase = \"A String\";\nTitleCaseOver = \"9000\";" ], "type": "waypoint", "challengeType": "1", @@ -412,8 +398,7 @@ "(function(z){return 'myVar = ' + z;})(myVar);" ], "solutions": [ - "var myVar = 87;", - "myVar++;" + "var myVar = 87;\nmyVar++;" ], "type": "waypoint", "challengeType": "1", @@ -451,8 +436,7 @@ "(function(z){return 'myVar = ' + z;})(myVar);" ], "solutions": [ - "var myVar = 87;", - "myVar--;" + "var myVar = 87;\nmyVar--;" ], "type": "waypoint", "challengeType": "1", @@ -612,13 +596,7 @@ "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" ], "solutions": [ - "var a = 3;", - "var b = 17;", - "var c = 12;", - "", - "a += 12;", - "b += 9;", - "c += 7;" + "var a = 3;\nvar b = 17;\nvar c = 12;\n\na += 12;\nb += 9;\nc += 7;" ], "type": "waypoint", "challengeType": "1", @@ -664,15 +642,7 @@ "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" ], "solutions": [ - "var a = 11;", - "var b = 9;", - "var c = 3;", - "", - "a -= 6;", - "b -= 15;", - "c -= 1;", - "", - "" + "var a = 11;\nvar b = 9;\nvar c = 3;\n\na -= 6;\nb -= 15;\nc -= 1;\n\n" ], "type": "waypoint", "challengeType": "1", @@ -718,13 +688,7 @@ "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" ], "solutions": [ - "var a = 20;", - "var b = 12;", - "var c = 96;", - "", - "a *= 5;", - "b *= 3;", - "c *= 10;" + "var a = 20;\nvar b = 12;\nvar c = 96;\n\na *= 5;\nb *= 3;\nc *= 10;" ], "type": "waypoint", "challengeType": "1", @@ -769,13 +733,7 @@ "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = \" + c; })(a,b,c);" ], "solutions": [ - "var a = 48;", - "var b = 108;", - "var c = 33;", - "", - "a /= 12;", - "b /= 4;", - "c /= 11;" + "var a = 48;\nvar b = 108;\nvar c = 33;\n\na /= 12;\nb /= 4;\nc /= 11;" ], "type": "waypoint", "challengeType": "1", @@ -819,14 +777,7 @@ "convert(30);" ], "solutions": [ - "function convert(Tc) {", - " var Tf = Tc * 9/5 + 32;", - " if(typeof Tf !== 'undefined') {", - "\treturn Tf;", - " } else {", - " return \"Tf not defined\";", - " }", - "}" + "function convert(Tc) {\n var Tf = Tc * 9/5 + 32;\n if(typeof Tf !== 'undefined') {\n\treturn Tf;\n } else {\n return \"Tf not defined\";\n }\n}" ], "type": "bonfire", "challengeType": "5", @@ -864,8 +815,7 @@ "if(typeof(myFirstName) !== \"undefined\" && typeof(myLastName) !== \"undefined\"){(function(){return myFirstName + ', ' + myLastName;})();}" ], "solutions": [ - "var myFirstName = \"Alan\";", - "var myLastName = \"Turing\";" + "var myFirstName = \"Alan\";\nvar myLastName = \"Turing\";" ], "type": "waypoint", "challengeType": "1" @@ -1029,8 +979,7 @@ "" ], "solutions": [ - "var myStr = \"This is the first sentance. \";", - "myStr += \"This is the second sentance.\";" + "var myStr = \"This is the first sentance. \";\nmyStr += \"This is the second sentance.\";" ], "type": "waypoint", "challengeType": "1", @@ -1065,8 +1014,7 @@ "" ], "solutions": [ - "var myName = \"Bob\";", - "var myStr = \"My name is \" + myName + \" and I am swell!\";" + "var myName = \"Bob\";\nvar myStr = \"My name is \" + myName + \" and I am swell!\";" ], "type": "waypoint", "challengeType": "1", @@ -1102,13 +1050,7 @@ "" ], "solutions": [ - "var anAdjective = \"awesome!\";", - "var ourStr = \"Free Code Camp is \";", - "ourStr += anAdjective;", - "", - "var someAdjective = \"neat\";", - "var myStr = \"Learning to code is \";", - "myStr += someAdjective;" + "var anAdjective = \"awesome!\";\nvar ourStr = \"Free Code Camp is \";\nourStr += anAdjective;\n\nvar someAdjective = \"neat\";\nvar myStr = \"Learning to code is \";\nmyStr += someAdjective;" ], "type": "waypoint", "challengeType": "1", @@ -1190,11 +1132,7 @@ "(function(v){return v;})(firstLetterOfLastName);" ], "solutions": [ - "var firstLetterOfLastName = \"\";", - "var lastName = \"Lovelace\";", - "", - "// Only change code below this line", - "firstLetterOfLastName = lastName.length" + "var firstLetterOfLastName = \"\";\nvar lastName = \"Lovelace\";\n\n// Only change code below this line\nfirstLetterOfLastName = lastName.length" ], "type": "waypoint", "challengeType": "1" @@ -1230,8 +1168,7 @@ "" ], "solutions": [ - "var myStr = \"Jello World\";", - "myStr = \"Hello World\";" + "var myStr = \"Jello World\";\nmyStr = \"Hello World\";" ], "type": "waypoint", "challengeType": "1", @@ -1272,8 +1209,7 @@ "(function(v){return v;})(thirdLetterOfLastName);" ], "solutions": [ - "var lastName = \"Lovelace\";", - "var thirdLetterOfLastName = lastName[2];" + "var lastName = \"Lovelace\";\nvar thirdLetterOfLastName = lastName[2];" ], "type": "waypoint", "challengeType": "1" @@ -1310,8 +1246,7 @@ "(function(v){return v;})(lastLetterOfLastName);" ], "solutions": [ - "var lastName = \"Lovelace\";", - "var lastLetterOfLastName = lastName[lastName.length - 1];" + "var lastName = \"Lovelace\";\nvar lastLetterOfLastName = lastName[lastName.length - 1];" ], "type": "waypoint", "challengeType": "1" @@ -1348,8 +1283,7 @@ "(function(v){return v;})(secondToLastLetterOfLastName);" ], "solutions": [ - "var lastName = \"Lovelace\";", - "var secondToLastLetterOfLastName = lastName[lastName.length - 2];" + "var lastName = \"Lovelace\";\nvar secondToLastLetterOfLastName = lastName[lastName.length - 2];" ], "type": "waypoint", "challengeType": "1" @@ -1388,12 +1322,7 @@ "var test2 = wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\");" ], "solutions": [ - "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {", - " var result = \"\";", - " result = \"Once there was a \" + myNoun + \" which was very \" + myAdjective + \". \";", - "\tresult += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";", - "\treturn result;", - "}" + "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {\n var result = \"\";\n result = \"Once there was a \" + myNoun + \" which was very \" + myAdjective + \". \";\n\tresult += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";\n\treturn result;\n}" ], "type": "bonfire", "challengeType": "5", @@ -1493,8 +1422,7 @@ "if(typeof(myArray) !== \"undefined\" && typeof(myData) !== \"undefined\"){(function(y,z){return 'myArray = ' + JSON.stringify(y) + ', myData = ' + JSON.stringify(z);})(myArray, myData);}" ], "solutions": [ - "var myArray = [1,2,3];", - "var myData = myArray[0];" + "var myArray = [1,2,3];\nvar myData = myArray[0];" ], "type": "waypoint", "challengeType": "1" @@ -1529,8 +1457,7 @@ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" ], "solutions": [ - "var myArray = [1,2,3];", - "myArray[0] = 3;" + "var myArray = [1,2,3];\nmyArray[0] = 3;" ], "type": "waypoint", "challengeType": "1" @@ -1562,8 +1489,7 @@ "if(typeof(myArray) !== \"undefined\"){(function(){return \"myData: \" + myData + \" myArray: \" + JSON.stringify(myArray);})();}" ], "solutions": [ - "var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];", - "var myData = myArray[2][1];" + "var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];\nvar myData = myArray[2][1];" ], "type": "waypoint", "challengeType": "1" @@ -1600,8 +1526,7 @@ "(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);" ], "solutions": [ - "var myArray = [[\"John\", 23], [\"cat\", 2]];", - "myArray.push([\"dog\",3]);" + "var myArray = [[\"John\", 23], [\"cat\", 2]];\nmyArray.push([\"dog\",3]);" ], "type": "waypoint", "challengeType": "1" @@ -1675,10 +1600,7 @@ "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);" ], "solutions": [ - "var myArray = [\"John\", 23, [\"dog\", 3]];", - "", - "// Only change code below this line.", - "var removedFromMyArray = myArray.shift();" + "var myArray = [\"John\", 23, [\"dog\", 3]];\n\n// Only change code below this line.\nvar removedFromMyArray = myArray.shift();" ], "type": "waypoint", "challengeType": "1" @@ -1714,9 +1636,7 @@ "(function(y, z){return 'myArray = ' + JSON.stringify(y);})(myArray);" ], "solutions": [ - "var myArray = [[\"John\", 23], [\"dog\", 3]];", - "myArray.shift();", - "myArray.unshift([\"Paul\", 35]);" + "var myArray = [[\"John\", 23], [\"dog\", 3]];\nmyArray.shift();\nmyArray.unshift([\"Paul\", 35]);" ], "type": "waypoint", "challengeType": "1" @@ -1767,13 +1687,7 @@ "})(myList);" ], "solutions": [ - "var myList = [", - " [\"Candy\", 10],", - " [\"Potatoes\", 12],", - " [\"Eggs\", 12],", - " [\"Catfood\", 1],", - " [\"Toads\", 9]", - "];" + "var myList = [\n [\"Candy\", 10],\n [\"Potatoes\", 12],\n [\"Eggs\", 12],\n [\"Catfood\", 1],\n [\"Toads\", 9]\n];" ], "type": "bonfire", "challengeType": "5", @@ -1837,10 +1751,7 @@ "}" ], "solutions": [ - "function myFunction() {", - " console.log(\"Hi World\");", - "}", - "myFunction();" + "function myFunction() {\n console.log(\"Hi World\");\n}\nmyFunction();" ], "type": "waypoint", "challengeType": "1" @@ -2017,19 +1928,7 @@ "" ], "solutions": [ - "function myFunction() {", - " var myVar;", - " console.log(myVar);", - "}", - "myFunction();", - "", - "// run and check the console ", - "// myVar is not defined outside of myFunction", - "", - "", - "// now remove the console.log line to pass the test", - "", - "" + "function myFunction() {\n var myVar;\n console.log(myVar);\n}\nmyFunction();\n\n// run and check the console \n// myVar is not defined outside of myFunction\n\n\n// now remove the console.log line to pass the test\n\n" ], "type": "waypoint", "challengeType": "1", @@ -2072,11 +1971,7 @@ "myFunction();" ], "solutions": [ - "var outerWear = \"T-Shirt\";", - "function myFunction() {", - " var outerWear = \"sweater\";", - " return outerWear;", - "}" + "var outerWear = \"T-Shirt\";\nfunction myFunction() {\n var outerWear = \"sweater\";\n return outerWear;\n}" ], "type": "waypoint", "challengeType": "1", @@ -2118,9 +2013,7 @@ "(function() { if(typeof timesFive === 'function'){ return \"timesfive(5) === \" + timesFive(5); } else { return \"timesFive is not a function\"} })();" ], "solutions": [ - "function timesFive(num) {", - " return num * 5;", - "}" + "function timesFive(num) {\n return num * 5;\n}" ], "type": "waypoint", "challengeType": "1", @@ -2222,12 +2115,7 @@ "(function() { return logOutput.join(\"\\n\");})();" ], "solutions": [ - "var arr = [ 1,2,3,4,5];", - "", - "function queue(myArr, item) {", - " myArr.push(item);", - " return myArr.shift();", - "}" + "var arr = [ 1,2,3,4,5];\n\nfunction queue(myArr, item) {\n myArr.push(item);\n return myArr.shift();\n}" ], "type": "bonfire", "challengeType": "5", @@ -2281,12 +2169,7 @@ "myFunction(10);" ], "solutions": [ - "function myFunction(testMe) {", - " if (testMe > 5) {", - " return 'Yes';", - " }", - " return 'No';", - "}" + "function myFunction(testMe) {\n if (testMe > 5) {\n return 'Yes';\n }\n return 'No';\n}" ], "type": "waypoint", "challengeType": "1" @@ -2324,12 +2207,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val == 12) {", - " return \"Equal\";", - " }", - " return \"Not Equal\";", - "}" + "function myTest(val) {\n if (val == 12) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2370,12 +2248,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val == 7) {", - " return \"Equal\";", - " }", - " return \"Not Equal\";", - "}" + "function myTest(val) {\n if (val == 7) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2417,12 +2290,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val != 99) {", - " return \"Not Equal\";", - " }", - " return \"Equal\";", - "}" + "function myTest(val) {\n if (val != 99) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2468,12 +2336,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val != 17) {", - " return \"Not Equal\";", - " }", - " return \"Equal\";", - "}" + "function myTest(val) {\n if (val != 17) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2520,15 +2383,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val > 100) { // Change this line", - " return \"Over 100\";", - " }", - " if (val > 10) { // Change this line", - " return \"Over 10\";", - " }", - " return \"10 or Under\";", - "}" + "function myTest(val) {\n if (val > 100) { // Change this line\n return \"Over 100\";\n }\n if (val > 10) { // Change this line\n return \"Over 10\";\n }\n return \"10 or Under\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2576,17 +2431,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val >= 20) { // Change this line", - " return \"20 or Over\";", - " }", - " ", - " if (val >= 10) { // Change this line", - " return \"10 or Over\";", - " }", - "", - " return \"9 or Under\";", - "}" + "function myTest(val) {\n if (val >= 20) { // Change this line\n return \"20 or Over\";\n }\n \n if (val >= 10) { // Change this line\n return \"10 or Over\";\n }\n\n return \"9 or Under\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2633,17 +2478,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val < 25) { // Change this line", - " return \"Under 25\";", - " }", - " ", - " if (val < 55) { // Change this line", - " return \"Under 55\";", - " }", - "", - " return \"55 or Over\";", - "}" + "function myTest(val) {\n if (val < 25) { // Change this line\n return \"Under 25\";\n }\n \n if (val < 55) { // Change this line\n return \"Under 55\";\n }\n\n return \"55 or Over\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2692,17 +2527,7 @@ "" ], "solutions": [ - "function myTest(val) {", - " if (val <= 12) { // Change this line", - " return \"Smaller Than or Equal to 12\";", - " }", - " ", - " if (val <= 24) { // Change this line", - " return \"Smaller Than or Equal to 24\";", - " }", - "", - " return \"25 or More\";", - "}" + "function myTest(val) {\n if (val <= 12) { // Change this line\n return \"Smaller Than or Equal to 12\";\n }\n \n if (val <= 24) { // Change this line\n return \"Smaller Than or Equal to 24\";\n }\n\n return \"25 or More\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2755,12 +2580,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {", - " if (val >= 25 && val <= 50) {", - " return \"Yes\";", - " }", - " return \"No\";", - "}" + "function myTest(val) {\n if (val >= 25 && val <= 50) {\n return \"Yes\";\n }\n return \"No\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2815,12 +2635,7 @@ "myTest(15);" ], "solutions": [ - "function myTest(val) {", - " if (val < 10 || val > 20) {", - " return \"Outside\";", - " }", - " return \"Inside\";", - "}" + "function myTest(val) {\n if (val < 10 || val > 20) {\n return \"Outside\";\n }\n return \"Inside\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2871,15 +2686,7 @@ "" ], "solutions": [ - "function myTest(val) {", - " var result = \"\";", - " if(val > 5) {", - " result = \"Bigger than 5\";", - " } else {", - " result = \"5 or Smaller\";", - " }", - " return result;", - "}" + "function myTest(val) {\n var result = \"\";\n if(val > 5) {\n result = \"Bigger than 5\";\n } else {\n result = \"5 or Smaller\";\n }\n return result;\n}" ], "type": "waypoint", "challengeType": "1", @@ -2926,15 +2733,7 @@ "" ], "solutions": [ - "function myTest(val) {", - " if(val > 10) {", - " return \"10 or Bigger\";", - " } else if(val < 5) {", - " return \"Smaller than 5\";", - " } else {", - " return \"Between 5 and 10\";", - " }", - "}" + "function myTest(val) {\n if(val > 10) {\n return \"10 or Bigger\";\n } else if(val < 5) {\n return \"Smaller than 5\";\n } else {\n return \"Between 5 and 10\";\n }\n}" ], "type": "waypoint", "challengeType": "1", @@ -2983,19 +2782,7 @@ "myTest(7);" ], "solutions": [ - "function myTest(num) {", - " if (num < 5) {", - " return \"Tiny\";", - " } else if (num < 10) {", - " return \"Small\";", - " } else if (num < 15) {", - " return \"Medium\";", - " } else if (num < 20) {", - " return \"Large\";", - " } else {", - " return \"Huge\";", - " }", - "}" + "function myTest(num) {\n if (num < 5) {\n return \"Tiny\";\n } else if (num < 10) {\n return \"Small\";\n } else if (num < 15) {\n return \"Medium\";\n } else if (num < 20) {\n return \"Large\";\n } else {\n return \"Huge\";\n }\n}" ], "type": "waypoint", "challengeType": "1", @@ -3041,33 +2828,7 @@ "golfScore(5, 4);" ], "solutions": [ - "function golfScore(par, strokes) {", - " if (strokes === 1) {", - " return \"Hole-in-one!\";", - " }", - " ", - " if (strokes <= par - 2) {", - " return \"Eagle\";", - " }", - " ", - " if (strokes === par - 1) {", - " return \"Birdie\";", - " }", - " ", - " if (strokes === par) {", - " return \"Par\";", - " }", - " ", - " if (strokes === par + 1) {", - " return \"Bogey\";", - " }", - " ", - " if(strokes === par + 2) {", - " return \"Double Bogey\";", - " }", - " ", - " return \"Go Home!\";", - "}" + "function golfScore(par, strokes) {\n if (strokes === 1) {\n return \"Hole-in-one!\";\n }\n \n if (strokes <= par - 2) {\n return \"Eagle\";\n }\n \n if (strokes === par - 1) {\n return \"Birdie\";\n }\n \n if (strokes === par) {\n return \"Par\";\n }\n \n if (strokes === par + 1) {\n return \"Bogey\";\n }\n \n if(strokes === par + 2) {\n return \"Double Bogey\";\n }\n \n return \"Go Home!\";\n}" ], "type": "bonfire", "challengeType": "5", @@ -3113,24 +2874,7 @@ "" ], "solutions": [ - "function myTest(val) {", - " var answer = \"\";", - "", - " switch (val) {", - " case 1:", - " answer = \"alpha\";", - " break;", - " case 2:", - " answer = \"beta\";", - " break;", - " case 3:", - " answer = \"gamma\";", - " break;", - " case 4:", - " answer = \"delta\";", - " }", - " return answer; ", - "}" + "function myTest(val) {\n var answer = \"\";\n\n switch (val) {\n case 1:\n answer = \"alpha\";\n break;\n case 2:\n answer = \"beta\";\n break;\n case 3:\n answer = \"gamma\";\n break;\n case 4:\n answer = \"delta\";\n }\n return answer; \n}" ], "type": "waypoint", "challengeType": "1", @@ -3176,24 +2920,7 @@ "" ], "solutions": [ - "function myTest(val) {", - " var answer = \"\";", - "", - " switch(val) {", - " case \"a\":", - " answer = \"apple\";", - " break;", - " case \"b\":", - " answer = \"bird\";", - " break;", - " case \"c\":", - " answer = \"cat\";", - " break;", - " default:", - " answer = \"stuff\";", - " }", - " return answer; ", - "}" + "function myTest(val) {\n var answer = \"\";\n\n switch(val) {\n case \"a\":\n answer = \"apple\";\n break;\n case \"b\":\n answer = \"bird\";\n break;\n case \"c\":\n answer = \"cat\";\n break;\n default:\n answer = \"stuff\";\n }\n return answer; \n}" ], "type": "waypoint", "challengeType": "1", @@ -3245,28 +2972,7 @@ "" ], "solutions": [ - "function myTest(val) {", - " var answer = \"\";", - " ", - " switch (val) {", - " case 1:", - " case 2:", - " case 3:", - " answer = \"Low\";", - " break;", - " case 4:", - " case 5:", - " case 6:", - " answer = \"Mid\";", - " break;", - " case 7:", - " case 8:", - " case 9:", - " answer = \"High\";", - " }", - " ", - " return answer; ", - "}" + "function myTest(val) {\n var answer = \"\";\n \n switch (val) {\n case 1:\n case 2:\n case 3:\n answer = \"Low\";\n break;\n case 4:\n case 5:\n case 6:\n answer = \"Mid\";\n break;\n case 7:\n case 8:\n case 9:\n answer = \"High\";\n }\n \n return answer; \n}" ], "type": "waypoint", "challengeType": "1", @@ -3326,27 +3032,7 @@ "" ], "solutions": [ - "function myTest(val) {", - " var answer = \"\";", - "", - " switch (val) {", - " case \"bob\":", - " answer = \"Marley\";", - " break;", - " case 42:", - " answer = \"The Answer\";", - " break;", - " case 1:", - " answer = \"There is no #1\";", - " break;", - " case 99:", - " answer = \"Missed me by this much!\";", - " break;", - " case 7:", - " answer = \"Ate Nine\";", - " }", - " return answer; ", - "}" + "function myTest(val) {\n var answer = \"\";\n\n switch (val) {\n case \"bob\":\n answer = \"Marley\";\n break;\n case 42:\n answer = \"The Answer\";\n break;\n case 1:\n answer = \"There is no #1\";\n break;\n case 99:\n answer = \"Missed me by this much!\";\n break;\n case 7:\n answer = \"Ate Nine\";\n }\n return answer; \n}" ], "type": "waypoint", "challengeType": "1", @@ -3391,9 +3077,7 @@ "" ], "solutions": [ - "function isLess(a, b) {", - " return a < b;", - "}" + "function isLess(a, b) {\n return a < b;\n}" ], "type": "waypoint", "challengeType": "1", @@ -3442,12 +3126,7 @@ "" ], "solutions": [ - "function abTest(a, b) {", - " if(a < 0 || b < 0) {", - " return undefined;", - " } ", - " return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));", - "}" + "function abTest(a, b) {\n if(a < 0 || b < 0) {\n return undefined;\n } \n return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));\n}" ], "type": "waypoint", "challengeType": "1", @@ -3491,29 +3170,7 @@ "cc(2); cc(3); cc(7); cc('K'); cc('A');" ], "solutions": [ - "var count = 0;", - "function cc(card) {", - " switch(card) {", - " case 2:", - " case 3:", - " case 4:", - " case 5:", - " case 6:", - " count++;", - " break;", - " case 10:", - " case 'J':", - " case 'Q':", - " case 'K':", - " case 'A':", - " count--;", - " }", - " if(count > 0) {", - " return count + \" Bet\";", - " } else {", - " return count + \" Hold\";", - " }", - "}" + "var count = 0;\nfunction cc(card) {\n switch(card) {\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n count++;\n break;\n case 10:\n case 'J':\n case 'Q':\n case 'K':\n case 'A':\n count--;\n }\n if(count > 0) {\n return count + \" Bet\";\n } else {\n return count + \" Hold\";\n }\n}" ], "type": "bonfire", "challengeType": "5", @@ -3605,14 +3262,7 @@ "(function(a,b) { return \"hatValue = '\" + a + \"', shirtValue = '\" + b + \"'\"; })(hatValue,shirtValue);" ], "solutions": [ - "var testObj = {", - " \"hat\": \"ballcap\",", - " \"shirt\": \"jersey\",", - " \"shoes\": \"cleats\"", - "};", - "", - "var hatValue = testObj.hat; ", - "var shirtValue = testObj.shirt;" + "var testObj = {\n \"hat\": \"ballcap\",\n \"shirt\": \"jersey\",\n \"shoes\": \"cleats\"\n};\n\nvar hatValue = testObj.hat; \nvar shirtValue = testObj.shirt;" ], "type": "waypoint", "challengeType": "1", @@ -3658,13 +3308,7 @@ "(function(a,b) { return \"entreeValue = '\" + a + \"', shirtValue = '\" + b + \"'\"; })(entreeValue,drinkValue);" ], "solutions": [ - "var testObj = {", - " \"an entree\": \"hamburger\",", - " \"my side\": \"veggies\",", - " \"the drink\": \"water\"", - "};", - "var entreeValue = testObj[\"an entree\"];", - "var drinkValue = testObj['the drink'];" + "var testObj = {\n \"an entree\": \"hamburger\",\n \"my side\": \"veggies\",\n \"the drink\": \"water\"\n};\nvar entreeValue = testObj[\"an entree\"];\nvar drinkValue = testObj['the drink'];" ], "type": "waypoint", "challengeType": "1", @@ -3709,8 +3353,7 @@ "" ], "solutions": [ - "var playerNumber = 16;", - "var player = testObj[playerNumber];" + "var playerNumber = 16;\nvar player = testObj[playerNumber];" ], "type": "waypoint", "challengeType": "1", @@ -3810,13 +3453,7 @@ "(function(z){return z;})(myDog);" ], "solutions": [ - "var myDog = {", - " \"name\": \"Happy Coder\",", - " \"legs\": 4,", - " \"tails\": 1,", - " \"friends\": [\"Free Code Camp Campers\"]", - "};", - "myDog.bark = \"Woof Woof\";" + "var myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"]\n};\nmyDog.bark = \"Woof Woof\";" ], "type": "waypoint", "challengeType": "1" @@ -3863,15 +3500,7 @@ "(function(z){return z;})(myDog);" ], "solutions": [ - "// Setup", - "var myDog = {", - " \"name\": \"Happy Coder\",", - " \"legs\": 4,", - " \"tails\": 1,", - " \"friends\": [\"Free Code Camp Campers\"],", - " \"bark\": \"woof\"", - "};", - "delete myDog.tails;" + "// Setup\nvar myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"],\n \"bark\": \"woof\"\n};\ndelete myDog.tails;" ], "type": "waypoint", "challengeType": "1" @@ -3929,24 +3558,7 @@ "" ], "solutions": [ - "function phoneticLookup(val) {", - " var result = \"\";", - "", - " var lookup = {", - " alpha: \"Adams\",", - " bravo: \"Boston\",", - " charlie: \"Chicago\",", - " delta: \"Denver\",", - " echo: \"Easy\",", - " foxtrot: \"Frank\"", - " };", - "", - " result = lookup[val];", - "", - " return result;", - "}", - "", - "phoneticLookup(\"charlie\");" + "function phoneticLookup(val) {\n var result = \"\";\n\n var lookup = {\n alpha: \"Adams\",\n bravo: \"Boston\",\n charlie: \"Chicago\",\n delta: \"Denver\",\n echo: \"Easy\",\n foxtrot: \"Frank\"\n };\n\n result = lookup[val];\n\n return result;\n}\n\nphoneticLookup(\"charlie\");" ], "type": "waypoint", "challengeType": "1", @@ -3993,18 +3605,7 @@ "" ], "solutions": [ - "var myObj = {", - " gift: \"pony\",", - " pet: \"kitten\",", - " bed: \"sleigh\"", - "};", - "function checkObj(checkProp) {", - " if(myObj.hasOwnProperty(checkProp)) {", - " return myObj[checkProp];", - " } else {", - " return \"Not Found\";", - " }", - "}" + "var myObj = {\n gift: \"pony\",\n pet: \"kitten\",\n bed: \"sleigh\"\n};\nfunction checkObj(checkProp) {\n if(myObj.hasOwnProperty(checkProp)) {\n return myObj[checkProp];\n } else {\n return \"Not Found\";\n }\n}" ], "type": "waypoint", "challengeType": "1" @@ -4052,31 +3653,7 @@ "(function(x){ if (Array.isArray(x)) { return JSON.stringify(x); } return \"myMusic is not an array\"})(myMusic);" ], "solutions": [ - "var myMusic = [", - " {", - " \t\"artist\": \"Billy Joel\",", - " \"title\": \"Piano Man\",", - " \"release_year\": 1993,", - " \"formats\": [ ", - " \"CS\", ", - " \"8T\", ", - " \"LP\" ],", - " \"gold\": true", - " }, ", - " {", - " \"artist\": \"ABBA\",", - " \"title\": \"Ring Ring\",", - " \"release_year\": 1973,", - " \"formats\": [ ", - " \"CS\", ", - " \"8T\", ", - " \"LP\",", - "\t \"CD\",", - "\t]", - " }", - "}", - " // Add record here", - "];" + "var myMusic = [\n {\n \t\"artist\": \"Billy Joel\",\n \"title\": \"Piano Man\",\n \"release_year\": 1993,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\" ],\n \"gold\": true\n }, \n {\n \"artist\": \"ABBA\",\n \"title\": \"Ring Ring\",\n \"release_year\": 1973,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\",\n\t \"CD\",\n\t]\n }\n}\n // Add record here\n];" ], "type": "waypoint", "challengeType": "1", @@ -4124,18 +3701,7 @@ "(function(x) { if(typeof gloveBoxContents != 'undefined') { return \"gloveBoxContents = \", x} else return \"gloveBoxContents is undefined\";})(gloveBoxContents);" ], "solutions": [ - "var myStorage = {", - " \"car\": {", - " \"inside\": {", - " \"glove box\": \"maps\",", - " \"passenger seat\": \"crumbs\"", - " },", - " \"outside\": {", - " \"trunk\": \"jack\"", - " }", - " }", - "};", - "var gloveBoxContents = myStorage.car.inside['glove box']; // Change this line" + "var myStorage = {\n \"car\": {\n \"inside\": {\n \"glove box\": \"maps\",\n \"passenger seat\": \"crumbs\"\n },\n \"outside\": {\n \"trunk\": \"jack\"\n }\n }\n};\nvar gloveBoxContents = myStorage.car.inside['glove box']; // Change this line" ], "type": "waypoint", "challengeType": "1", @@ -4293,48 +3859,7 @@ "(function(x) { return \"collection = \\n\" + JSON.stringify(x, '\\n', 2); })(collection);" ], "solutions": [ - "var collection = {", - " 2548: {", - " album: \"Slippery When Wet\",", - " artist: \"Bon Jovi\",", - " tracks: [ ", - " \"Let It Rock\", ", - " \"You Give Love a Bad Name\" ", - " ]", - " },", - " 2468: {", - " album: \"1999\",", - " artist: \"Prince\",", - " tracks: [ ", - " \"1999\", ", - " \"Little Red Corvette\" ", - " ]", - " },", - " 1245: {", - " artist: \"Robert Palmer\",", - " tracks: [ ]", - " },", - " 5439: {", - " album: \"ABBA Gold\"", - " }", - "};", - "// Keep a copy of the collection for tests", - "var collectionCopy = JSON.parse(JSON.stringify(collection));", - "", - "// Only change code below this line", - "function update(id, prop, value) {", - " if(value !== \"\") {", - " if(prop === \"tracks\") {", - " collection[id][prop].push(value);", - " } else {", - " collection[id][prop] = value;", - " }", - " } else {", - " delete collection[id][prop];", - " }", - "", - " return collection;", - "}" + "var collection = {\n 2548: {\n album: \"Slippery When Wet\",\n artist: \"Bon Jovi\",\n tracks: [ \n \"Let It Rock\", \n \"You Give Love a Bad Name\" \n ]\n },\n 2468: {\n album: \"1999\",\n artist: \"Prince\",\n tracks: [ \n \"1999\", \n \"Little Red Corvette\" \n ]\n },\n 1245: {\n artist: \"Robert Palmer\",\n tracks: [ ]\n },\n 5439: {\n album: \"ABBA Gold\"\n }\n};\n// Keep a copy of the collection for tests\nvar collectionCopy = JSON.parse(JSON.stringify(collection));\n\n// Only change code below this line\nfunction update(id, prop, value) {\n if(value !== \"\") {\n if(prop === \"tracks\") {\n collection[id][prop].push(value);\n } else {\n collection[id][prop] = value;\n }\n } else {\n delete collection[id][prop];\n }\n\n return collection;\n}" ], "type": "bonfire", "challengeType": "5", @@ -4496,12 +4021,7 @@ "(function(t) { if(typeof t !== 'undefined') { return \"Total = \" + t; } else { return \"Total is undefined\";}})(total);" ], "solutions": [ - "var myArr = [ 2, 3, 4, 5, 6];", - "var total = 0;", - "", - "for (var i = 0; i < myArr.length; i++) {", - " total += myArr[i];", - "}" + "var myArr = [ 2, 3, 4, 5, 6];\nvar total = 0;\n\nfor (var i = 0; i < myArr.length; i++) {\n total += myArr[i];\n}" ], "type": "waypoint", "challengeType": "1", @@ -4544,19 +4064,7 @@ "" ], "solutions": [ - "function multiplyAll(arr) {", - " var product = 1;", - " for (var i = 0; i < arr.length; i++) {", - " for (var j = 0; j < arr[i].length; j++) {", - " product *= arr[i][j];", - " }", - " }", - " return product;", - "}", - "", - "multiplyAll([[1,2],[3,4],[5,6,7]]);", - "", - "" + "function multiplyAll(arr) {\n var product = 1;\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr[i].length; j++) {\n product *= arr[i][j];\n }\n }\n return product;\n}\n\nmultiplyAll([[1,2],[3,4],[5,6,7]]);\n\n" ], "type": "waypoint", "challengeType": "1", @@ -4630,31 +4138,7 @@ "" ], "solutions": [ - "var lookup = {", - " 'A': 'N','B': 'O','C': 'P','D': 'Q',", - " 'E': 'R','F': 'S','G': 'T','H': 'U',", - " 'I': 'V','J': 'W','K': 'X','L': 'Y',", - " 'M': 'Z','N': 'A','O': 'B','P': 'C',", - " 'Q': 'D','R': 'E','S': 'F','T': 'G',", - " 'U': 'H','V': 'I','W': 'J','X': 'K',", - " 'Y': 'L','Z': 'M' ", - "};", - "", - "function rot13(encodedStr) {", - " var codeArr = encodedStr.split(\"\"); // String to Array", - " var decodedArr = []; // Your Result goes here", - " // Only change code below this line", - " ", - " decodedArr = codeArr.map(function(letter) {", - " if(lookup.hasOwnProperty(letter)) {", - " letter = lookup[letter];", - " }", - " return letter;", - " });", - "", - " // Only change code above this line", - " return decodedArr.join(\"\"); // Array to String", - "}" + "var lookup = {\n 'A': 'N','B': 'O','C': 'P','D': 'Q',\n 'E': 'R','F': 'S','G': 'T','H': 'U',\n 'I': 'V','J': 'W','K': 'X','L': 'Y',\n 'M': 'Z','N': 'A','O': 'B','P': 'C',\n 'Q': 'D','R': 'E','S': 'F','T': 'G',\n 'U': 'H','V': 'I','W': 'J','X': 'K',\n 'Y': 'L','Z': 'M' \n};\n\nfunction rot13(encodedStr) {\n var codeArr = encodedStr.split(\"\"); // String to Array\n var decodedArr = []; // Your Result goes here\n // Only change code below this line\n \n decodedArr = codeArr.map(function(letter) {\n if(lookup.hasOwnProperty(letter)) {\n letter = lookup[letter];\n }\n return letter;\n });\n\n // Only change code above this line\n return decodedArr.join(\"\"); // Array to String\n}" ], "type": "bonfire", "challengeType": "5", From 7a9228c4193ef993c291cf72adea94f2615bfc5a Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 28 Dec 2015 22:35:05 -0800 Subject: [PATCH 114/174] Correct broken/missing Solutions --- .../basic-javascript.json | 78 ++++++++++--------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 2d9453587f..11067ebea5 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -106,7 +106,7 @@ "assert(/var a;/.test(code) && /var b = 2;/.test(code), 'message: Do not change code above the line');", "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", "assert(typeof b === 'number' && b === 7, 'message: b should have a value of 7');", - "assert(code.match(/b\\s*=\\s*a\\s*;/g), 'message: a should be assigned to b with =');" + "assert(code.match(/b\\s*=\\s*a\\s*;/g) > 0, 'message: a should be assigned to b with =');" ], "challengeSeed": [ "// Setup", @@ -242,7 +242,7 @@ "" ], "solutions": [ - "var StUdLyCapVaR;\nvar properCamelCase;\nvar TitleCase;\n\nStUdLyCapVaR = 10;\nproperCamelCase = \"A String\";\nTitleCaseOver = \"9000\";" + "var StUdLyCapVaR;\nvar properCamelCase;\nvar TitleCaseOver;\n\nStUdLyCapVaR = 10;\nproperCamelCase = \"A String\";\nTitleCaseOver = 9000;" ], "type": "waypoint", "challengeType": "1", @@ -436,7 +436,7 @@ "(function(z){return 'myVar = ' + z;})(myVar);" ], "solutions": [ - "var myVar = 87;\nmyVar--;" + "var myVar = 11;\nmyVar--;" ], "type": "waypoint", "challengeType": "1", @@ -550,7 +550,7 @@ "(function(y){return 'remainder = '+y;})(remainder);" ], "solutions": [ - "" + "var remainder = 11 % 3;" ], "type": "waypoint", "challengeType": "1", @@ -688,7 +688,7 @@ "(function(a,b,c){ return \"a = \" + a + \", b = \" + b + \", c = '\" + c + \"'\"; })(a,b,c);" ], "solutions": [ - "var a = 20;\nvar b = 12;\nvar c = 96;\n\na *= 5;\nb *= 3;\nc *= 10;" + "var a = 5;\nvar b = 12;\nvar c = 4.6;\n\na *= 5;\nb *= 3;\nc *= 10;" ], "type": "waypoint", "challengeType": "1", @@ -767,7 +767,7 @@ "", " // Only change code above this line", " if(typeof Tf !== 'undefined') {", - "\treturn Tf;", + " return Tf;", " } else {", " return \"Tf not defined\";", " }", @@ -777,7 +777,7 @@ "convert(30);" ], "solutions": [ - "function convert(Tc) {\n var Tf = Tc * 9/5 + 32;\n if(typeof Tf !== 'undefined') {\n\treturn Tf;\n } else {\n return \"Tf not defined\";\n }\n}" + "function convert(Tc) {\n var Tf = Tc * 9/5 + 32;\n if(typeof Tf !== 'undefined') {\n return Tf;\n } else {\n return \"Tf not defined\";\n }\n}" ], "type": "bonfire", "challengeType": "5", @@ -944,7 +944,7 @@ "" ], "solutions": [ - "var myStr = \"This is the start. \" + \"This is the end.\";" + "var ourStr = \"I come first. \" + \"I come second.\";\nvar myStr = \"This is the start. \" + \"This is the end.\";" ], "type": "waypoint", "challengeType": "1", @@ -979,7 +979,7 @@ "" ], "solutions": [ - "var myStr = \"This is the first sentance. \";\nmyStr += \"This is the second sentance.\";" + "var ourStr = \"I come first. \";\nourStr += \"I come second.\";\n\nvar myStr = \"This is the first sentance. \";\nmyStr += \"This is the second sentance.\";" ], "type": "waypoint", "challengeType": "1", @@ -1132,7 +1132,7 @@ "(function(v){return v;})(firstLetterOfLastName);" ], "solutions": [ - "var firstLetterOfLastName = \"\";\nvar lastName = \"Lovelace\";\n\n// Only change code below this line\nfirstLetterOfLastName = lastName.length" + "var firstLetterOfLastName = \"\";\nvar lastName = \"Lovelace\";\n\n// Only change code below this line\nfirstLetterOfLastName = lastName[0];" ], "type": "waypoint", "challengeType": "1" @@ -1246,7 +1246,7 @@ "(function(v){return v;})(lastLetterOfLastName);" ], "solutions": [ - "var lastName = \"Lovelace\";\nvar lastLetterOfLastName = lastName[lastName.length - 1];" + "var firstName = \"Ada\";\nvar lastLetterOfFirstName = firstName[firstName.length - 1];\n\nvar lastName = \"Lovelace\";\nvar lastLetterOfLastName = lastName[lastName.length - 1];" ], "type": "waypoint", "challengeType": "1" @@ -1283,7 +1283,7 @@ "(function(v){return v;})(secondToLastLetterOfLastName);" ], "solutions": [ - "var lastName = \"Lovelace\";\nvar secondToLastLetterOfLastName = lastName[lastName.length - 2];" + "var firstName = \"Ada\";\nvar thirdToLastLetterOfFirstName = firstName[firstName.length - 3];\n\nvar lastName = \"Lovelace\";\nvar secondToLastLetterOfLastName = lastName[lastName.length - 2];" ], "type": "waypoint", "challengeType": "1" @@ -1311,7 +1311,7 @@ " ", "", " // Your code above this line", - "\treturn result;", + " return result;", "}", "", "// Change the words here to test your function", @@ -1322,7 +1322,7 @@ "var test2 = wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\");" ], "solutions": [ - "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {\n var result = \"\";\n result = \"Once there was a \" + myNoun + \" which was very \" + myAdjective + \". \";\n\tresult += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";\n\treturn result;\n}" + "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {\n var result = \"\";\n\n result = \"Once there was a \" + myNoun + \" which was very \" + myAdjective + \". \";\n result += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";\n\n return result;\n}" ], "type": "bonfire", "challengeType": "5", @@ -1520,7 +1520,7 @@ "", "// Only change code below this line.", "", - "\t" + "" ], "tail": [ "(function(z){return 'myArray = ' + JSON.stringify(z);})(myArray);" @@ -1564,7 +1564,7 @@ "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);" ], "solutions": [ - "" + "var myArray = [[\"John\", 23], [\"cat\", 2]];\nvar removedFromMyArray = myArray.pop();" ], "type": "waypoint", "challengeType": "1" @@ -1600,7 +1600,7 @@ "(function(y, z){return 'myArray = ' + JSON.stringify(y) + ' & removedFromMyArray = ' + JSON.stringify(z);})(myArray, removedFromMyArray);" ], "solutions": [ - "var myArray = [\"John\", 23, [\"dog\", 3]];\n\n// Only change code below this line.\nvar removedFromMyArray = myArray.shift();" + "var myArray = [[\"John\", 23], [\"dog\", 3]];\n\n// Only change code below this line.\nvar removedFromMyArray = myArray.shift();" ], "type": "waypoint", "challengeType": "1" @@ -1908,7 +1908,7 @@ ], "releasedOn": "January 1, 2016", "tests": [ - "" + "assert(code.match(/console\\.log/gi).length === 1, 'message: Remove the second console log');" ], "challengeSeed": [ "function myFunction() {", @@ -1928,7 +1928,7 @@ "" ], "solutions": [ - "function myFunction() {\n var myVar;\n console.log(myVar);\n}\nmyFunction();\n\n// run and check the console \n// myVar is not defined outside of myFunction\n\n\n// now remove the console.log line to pass the test\n\n" + "function myFunction() {\n var myVar;\n console.log(myVar);\n}\nmyFunction();" ], "type": "waypoint", "challengeType": "1", @@ -2055,7 +2055,7 @@ "(function(){return \"processed = \" + processed})();" ], "solutions": [ - "processed = process(7);" + "var processed = 0;\n\nfunction process(num) {\n return (num + 3) / 5;\n}\n\nprocessed = process(7);" ], "type": "waypoint", "challengeType": "1", @@ -2248,7 +2248,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {\n if (val == 7) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}" + "function myTest(val) {\n if (val === 7) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2336,7 +2336,7 @@ "myTest(10);" ], "solutions": [ - "function myTest(val) {\n if (val != 17) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}" + "function myTest(val) {\n if (val !== 17) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}" ], "type": "waypoint", "challengeType": "1", @@ -2364,7 +2364,8 @@ "assert(myTest(99) === \"Over 10\", 'message: myTest(99) should return \"Over 10\"');", "assert(myTest(100) === \"Over 10\", 'message: myTest(100) should return \"Over 10\"');", "assert(myTest(101) === \"Over 100\", 'message: myTest(101) should return \"Over 100\"');", - "assert(myTest(150) === \"Over 100\", 'message: myTest(150) should return \"Over 100\"');\nassert(code.match(/val\\s*>\\s*\\d+/g).length > 1, 'message: You should use the > operator at least twice');" + "assert(myTest(150) === \"Over 100\", 'message: myTest(150) should return \"Over 100\"');", + "assert(code.match(/val\\s*>\\s*\\d+/g).length > 1, 'message: You should use the > operator at least twice');" ], "challengeSeed": [ "function myTest(val) {", @@ -2569,7 +2570,7 @@ " if (val) {", " if (val) {", " return \"Yes\";", - "\t }", + " }", " }", "", " // Only change code above this line", @@ -3222,7 +3223,7 @@ "(function(z){return z;})(myDog);" ], "solutions": [ - "" + "var myDog = {\n \"name\": \"Camper\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"everything!\"] \n};" ], "type": "waypoint", "challengeType": "1" @@ -3243,7 +3244,8 @@ "assert(typeof hatValue === 'string' , 'message: hatValue should be a string');", "assert(hatValue === 'ballcap' , 'message: The value of hatValue should be \"ballcap\"');", "assert(typeof shirtValue === 'string' , 'message: shirtValue should be a string');", - "assert(shirtValue === 'jersey' , 'message: The value of shirtValue should be \"jersey\"');\nassert(code.match(/testObj\\.\\w+/g).length > 1, 'message: You should use dot notation twice');" + "assert(shirtValue === 'jersey' , 'message: The value of shirtValue should be \"jersey\"');", + "assert(code.match(/testObj\\.\\w+/g).length > 1, 'message: You should use dot notation twice');" ], "challengeSeed": [ "// Setup", @@ -3353,7 +3355,7 @@ "" ], "solutions": [ - "var playerNumber = 16;\nvar player = testObj[playerNumber];" + "var testObj = {\n 12: \"Namath\",\n 16: \"Montana\",\n 19: \"Unitas\"\n};\nvar playerNumber = 16;\nvar player = testObj[playerNumber];" ], "type": "waypoint", "challengeType": "1", @@ -3500,7 +3502,7 @@ "(function(z){return z;})(myDog);" ], "solutions": [ - "// Setup\nvar myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"],\n \"bark\": \"woof\"\n};\ndelete myDog.tails;" + "var ourDog = {\n \"name\": \"Camper\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"everything!\"],\n \"bark\": \"bow-wow\"\n};\n\nvar myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"],\n \"bark\": \"woof\"\n};\n\ndelete myDog.tails;" ], "type": "waypoint", "challengeType": "1" @@ -3524,7 +3526,7 @@ "assert(phoneticLookup(\"echo\") === 'Easy', 'message: phoneticLookup(\"echo\") should equal \"Easy\"');", "assert(phoneticLookup(\"foxtrot\") === 'Frank', 'message: phoneticLookup(\"foxtrot\") should equal \"Frank\"');", "assert(typeof phoneticLookup(\"\") === 'undefined', 'message: phoneticLookup(\"\") should equal undefined');", - "assert(!/case|switch|if/g.test(editor.getValue()), 'message: You should not use case, switch, or if statements'); " + "assert(!/case|switch|if/g.test(code), 'message: You should not use case, switch, or if statements'); " ], "challengeSeed": [ "// Setup", @@ -3558,7 +3560,7 @@ "" ], "solutions": [ - "function phoneticLookup(val) {\n var result = \"\";\n\n var lookup = {\n alpha: \"Adams\",\n bravo: \"Boston\",\n charlie: \"Chicago\",\n delta: \"Denver\",\n echo: \"Easy\",\n foxtrot: \"Frank\"\n };\n\n result = lookup[val];\n\n return result;\n}\n\nphoneticLookup(\"charlie\");" + "function phoneticLookup(val) {\n var result = \"\";\n\n var lookup = {\n alpha: \"Adams\",\n bravo: \"Boston\",\n charlie: \"Chicago\",\n delta: \"Denver\",\n echo: \"Easy\",\n foxtrot: \"Frank\"\n };\n\n result = lookup[val];\n\n return result;\n}" ], "type": "waypoint", "challengeType": "1", @@ -3636,7 +3638,7 @@ "challengeSeed": [ "var myMusic = [", " {", - " \t\"artist\": \"Billy Joel\",", + " \"artist\": \"Billy Joel\",", " \"title\": \"Piano Man\",", " \"release_year\": 1993,", " \"formats\": [ ", @@ -3653,7 +3655,7 @@ "(function(x){ if (Array.isArray(x)) { return JSON.stringify(x); } return \"myMusic is not an array\"})(myMusic);" ], "solutions": [ - "var myMusic = [\n {\n \t\"artist\": \"Billy Joel\",\n \"title\": \"Piano Man\",\n \"release_year\": 1993,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\" ],\n \"gold\": true\n }, \n {\n \"artist\": \"ABBA\",\n \"title\": \"Ring Ring\",\n \"release_year\": 1973,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\",\n\t \"CD\",\n\t]\n }\n}\n // Add record here\n];" + "var myMusic = [\n {\n \"artist\": \"Billy Joel\",\n \"title\": \"Piano Man\",\n \"release_year\": 1993,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\" ],\n \"gold\": true\n }, \n {\n \"artist\": \"ABBA\",\n \"title\": \"Ring Ring\",\n \"release_year\": 1973,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\",\n \"CD\",\n ]\n }\n];" ], "type": "waypoint", "challengeType": "1", @@ -3676,7 +3678,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(gloveBoxContents === \"maps\", 'message: gloveBoxContents should equal \"maps\"');", - "assert(/=\\s*myStorage\\.car\\.inside\\[([\"'])glove box\\1\\]/.test(code), 'message: Use dot and bracket notation to access myStorage');" + "assert(/=\\s*myStorage\\.car\\.inside\\[([\"'])glove box\\1\\]/g.test(code), 'message: Use dot and bracket notation to access myStorage');" ], "challengeSeed": [ "// Setup", @@ -3698,10 +3700,16 @@ "" ], "tail": [ - "(function(x) { if(typeof gloveBoxContents != 'undefined') { return \"gloveBoxContents = \", x} else return \"gloveBoxContents is undefined\";})(gloveBoxContents);" + "(function(x) { ", + " if(typeof x != 'undefined') { ", + " return \"gloveBoxContents = \" + x;", + " } else { ", + " return \"gloveBoxContents is undefined\";", + " }", + "})(gloveBoxContents);" ], "solutions": [ - "var myStorage = {\n \"car\": {\n \"inside\": {\n \"glove box\": \"maps\",\n \"passenger seat\": \"crumbs\"\n },\n \"outside\": {\n \"trunk\": \"jack\"\n }\n }\n};\nvar gloveBoxContents = myStorage.car.inside['glove box']; // Change this line" + "var myStorage = {\n \"car\": {\n \"inside\": {\n \"glove box\": \"maps\",\n \"passenger seat\": \"crumbs\"\n },\n \"outside\": {\n \"trunk\": \"jack\"\n }\n }\n};\n\nvar gloveBoxContents = myStorage.car.inside['glove box']; // Change this line" ], "type": "waypoint", "challengeType": "1", From e6e6fb9d0266f544d12918049b556f92fc67756f Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Mon, 28 Dec 2015 22:54:02 -0800 Subject: [PATCH 115/174] Fix test-challenges to use code/editor.getValue Also filters challenges with empty string tests --- seed/test-challenges.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/seed/test-challenges.js b/seed/test-challenges.js index 93a994c30c..5e5f1f444d 100644 --- a/seed/test-challenges.js +++ b/seed/test-challenges.js @@ -51,8 +51,23 @@ function fillAssert(t) { return assert; } -function createTest({ title, tests = [], solutions = [] }) { +function createTest({ + title, + tests = [], + solutions = [], + head = '', + tail = '' +}) { + solutions = solutions.filter(solution => !!solution); + tests = tests.filter(test => !!test); const plan = tests.length; + if (!plan) { + return Observable.just({ + title, + type: 'missing' + }); + } + return Observable.fromCallback(tape)(title) .doOnNext(t => solutions.length ? t.plan(plan) : t.end()) .flatMap(t => { @@ -64,16 +79,19 @@ function createTest({ title, tests = [], solutions = [] }) { }); } + return Observable.just(t) .map(fillAssert) /* eslint-disable no-unused-vars */ // assert is used within the eval .doOnNext(assert => { - /* eslint-enable no-unused-vars */ solutions.forEach(solution => { tests.forEach(test => { + const code = head + solution + tail; + const editor = { getValue() { return code; } }; + /* eslint-enable no-unused-vars */ try { - eval(solution + ';;' + test); + (() => { return eval(solution + ';;' + test); })(); } catch (e) { t.fail(e); } From 49b9c8c9c84eccd1c00dff0cf379c62d74d6bae9 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Mon, 28 Dec 2015 23:14:42 -0800 Subject: [PATCH 116/174] Fix head/tail are arrays --- seed/test-challenges.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/seed/test-challenges.js b/seed/test-challenges.js index 5e5f1f444d..71198d83ab 100644 --- a/seed/test-challenges.js +++ b/seed/test-challenges.js @@ -55,11 +55,13 @@ function createTest({ title, tests = [], solutions = [], - head = '', - tail = '' + head = [], + tail = [] }) { solutions = solutions.filter(solution => !!solution); tests = tests.filter(test => !!test); + head = head.join('\n'); + tail = tail.join('\n'); const plan = tests.length; if (!plan) { return Observable.just({ @@ -87,11 +89,13 @@ function createTest({ .doOnNext(assert => { solutions.forEach(solution => { tests.forEach(test => { - const code = head + solution + tail; + const code = solution; const editor = { getValue() { return code; } }; /* eslint-enable no-unused-vars */ try { - (() => { return eval(solution + ';;' + test); })(); + (() => { + return eval(head + solution + tail + ';;' + test); + })(); } catch (e) { t.fail(e); } From 1ee349447bd76385b8715f3423d6b5774d18bff7 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Mon, 28 Dec 2015 23:43:12 -0800 Subject: [PATCH 117/174] More solutions fixes --- .../basic-javascript.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 11067ebea5..562c420d5d 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -106,7 +106,7 @@ "assert(/var a;/.test(code) && /var b = 2;/.test(code), 'message: Do not change code above the line');", "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", "assert(typeof b === 'number' && b === 7, 'message: b should have a value of 7');", - "assert(code.match(/b\\s*=\\s*a\\s*;/g) > 0, 'message: a should be assigned to b with =');" + "assert(/b\\s*=\\s*a\\s*;/g.test(code) > 0, 'message: a should be assigned to b with =');" ], "challengeSeed": [ "// Setup", @@ -2115,7 +2115,7 @@ "(function() { return logOutput.join(\"\\n\");})();" ], "solutions": [ - "var arr = [ 1,2,3,4,5];\n\nfunction queue(myArr, item) {\n myArr.push(item);\n return myArr.shift();\n}" + "var myArr = [ 1,2,3,4,5];\n\nfunction queue(myArr, item) {\n myArr.push(item);\n return myArr.shift();\n}" ], "type": "bonfire", "challengeType": "5", @@ -3678,7 +3678,7 @@ "releasedOn": "January 1, 2016", "tests": [ "assert(gloveBoxContents === \"maps\", 'message: gloveBoxContents should equal \"maps\"');", - "assert(/=\\s*myStorage\\.car\\.inside\\[([\"'])glove box\\1\\]/g.test(code), 'message: Use dot and bracket notation to access myStorage');" + "assert(/=\\s*myStorage\\.car\\.inside\\[(\"|')glove box\\1\\]/g.test(code), 'message: Use dot and bracket notation to access myStorage');" ], "challengeSeed": [ "// Setup", @@ -3703,13 +3703,12 @@ "(function(x) { ", " if(typeof x != 'undefined') { ", " return \"gloveBoxContents = \" + x;", - " } else { ", - " return \"gloveBoxContents is undefined\";", " }", + " return \"gloveBoxContents is undefined\";", "})(gloveBoxContents);" ], "solutions": [ - "var myStorage = {\n \"car\": {\n \"inside\": {\n \"glove box\": \"maps\",\n \"passenger seat\": \"crumbs\"\n },\n \"outside\": {\n \"trunk\": \"jack\"\n }\n }\n};\n\nvar gloveBoxContents = myStorage.car.inside['glove box']; // Change this line" + "var myStorage = {\n \"car\": {\n \"inside\": {\n \"glove box\": \"maps\",\n \"passenger seat\": \"crumbs\"\n },\n \"outside\": {\n \"trunk\": \"jack\"\n }\n }\n};\n\nvar gloveBoxContents = myStorage.car.inside[\"glove box\"]; // Change this line" ], "type": "waypoint", "challengeType": "1", From 2d024a456ddd4287b038aacd5429018d8cfe78a1 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Tue, 29 Dec 2015 02:58:35 -0600 Subject: [PATCH 118/174] add react and d3 projects --- .../data-visualization-projects.json | 80 ++++++++----------- .../react-projects.json | 80 +++++++++---------- 2 files changed, 75 insertions(+), 85 deletions(-) diff --git a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json index b5fafceb92..9ac4e3991e 100644 --- a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json +++ b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json @@ -5,21 +5,18 @@ "challenges": [ { "id": "bd7168d8c242eddfaeb5bd13", - "title": "", + "title": "Visualize Data with a Bar Chart", "challengeSeed": [ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBBWd.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use D3.js to build this project.", + "User Story: I can see US Gross Domestic Product by quarter, over time.", + "User Story: I can mouse over a bar and see a tooltip with the GDP amount and exact year and month that bar represents.", + "Hint: Here's a dataset you can use to build this: https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/GDP-data.json", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -40,21 +37,18 @@ }, { "id": "bd7178d8c242eddfaeb5bd13", - "title": "", + "title": "Visualize Data with a Scatterplot Graph", "challengeSeed": [ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/GoNNEy.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use D3.js to build this project.", + "User Story: I can see performance time visualized in a scatterplot graph.", + "User Story: I can mouse over a plot to see a tooltip with additional details.", + "Hint: Here's a dataset you can use to build this: https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/cyclist-data.json", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -75,21 +69,19 @@ }, { "id": "bd7188d8c242eddfaeb5bd13", - "title": "", + "title": "Visualize Data with a Heat Map", "challengeSeed": [ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/rxWWGa.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use D3.js to build this project.", + "User Story: I can view a heat map of the temperature by month, sorted into rows by year.", + "User Story: Each month is colored based on its relative heat.", + "User Story: I can hover over a month to get its exact temperature.", + "Hint: Here's a dataset you can use to build this: https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/global-temperature.json", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -110,21 +102,21 @@ }, { "id": "bd7198d8c242eddfaeb5bd13", - "title": "", + "title": "Show Relationships with a Force-Directed Graph", "challengeSeed": [ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/KVNNXY.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use D3.js to build this project.", + "User Story: I can see a Force-directed Graph that shows which campers are posting links on Camper News to which domains.", + "User Story: I can see each camper's icon on their node.", + "User Story: I can see the relationship between the campers and the domains they're posting.", + "User Story: I can tell approximately many times campers have linked to a specific domain from it's node size.", + "User Story: I can tell approximately how many times a specific camper has posted a link from their node's size.", + "Hint: Here's the Camper News Hot Stories API endpoint: http://www.freecodecamp.com/news/hot.", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -145,21 +137,19 @@ }, { "id": "bd7108d8c242eddfaeb5bd13", - "title": "", + "title": "Map Data Across the Globe", "challengeSeed": [ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/mVEJag.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use D3.js to build this project.", + "User Story: I can see where all Meteorites landed on a world map.", + "User Story: I can tell the relative size of the meteorite, just by looking at the way it's represented on the map.", + "User Story: I can mouse over the meteorite's data point for additional data.", + "Hint: Here's a dataset you can use to build this: https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/meteorite-strike-data.json", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index 1f2031de12..2a10238b7b 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -10,16 +10,13 @@ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/obYYqW.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use both SASS and React to build this project.", + "User Story: I can type GitHub-flavored Markdown into a text area.", + "User Story: I can see a preview of the output of my markdown that is updated as I type.", + "Hint: You don't need to interperate Markdown yourself - you can import the Marked library for this: https://cdnjs.com/libraries/marked", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -45,16 +42,15 @@ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/qbqqJm/.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use both SASS and React to build this project.", + "User Story: I can see the a table of the Free Code Camp campers who've earned the most brownie points in the past 30 days.", + "User Story: I can see how many brownie points they've earned in the past 30 days, and how many they've earned total.", + "User Story: I can toggle between sorting the list by how many bronwie points they've earned in the past 30 days and by how many brownie points they've earned total.", + "Hint: To get the top 100 campers for the last 30 days: http://fcctop100.herokuapp.com/api/fccusers/recent/:sortColumnName.", + "Hint: To get the top 100 campers of all time: http://fcctop100.herokuapp.com/api/fccusers/alltime/:sortColumnName.", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -80,16 +76,16 @@ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/LGbbqj.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use both SASS and React to build this project.", + "User Story: I can create recipes that have names and ingredients.", + "User Story: I can see an index view where the names of all the recipes are visible.", + "User Story: I can click into any of those recipes to view it.", + "User Story: I can edit these recipes.", + "User Story: I can delete these recipes.", + "User Story: All new recipes I add are saved in my browser's local storage. If I refresh the page, these recipes will still be there.", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -115,16 +111,17 @@ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOrZ.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use both SASS and React to build this project.", + "User Story: When I first arrive at the game, it will randomly generate a board and start playing.", + "User Story: I can start and stop the board.", + "User Story: I can set up the board.", + "User Story: I can clear the board.", + "User Story: When I press start, the game will play out.", + "User Story: Each time the board changes, I can see how many generations have gone by.", + "Hint: Here's an overview of Conway's Game of Life with rules for your reference: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." @@ -150,16 +147,19 @@ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOEJ/.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "User Story: I can access all of the portfolio webpage's content just by scrolling.", - "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", - "User Story: I can see thumbnail images of different projects the portfolio creator has built (if you haven't built any websites before, use placeholders.)", - "User Story: I navigate to different sections of the webpage by clicking buttons in the navigation.", - "Don't worry if you don't have anything to showcase on your portfolio yet - you will build several apps on the next few CodePen challenges, and can come back and update your portfolio later.", - "There are many great portfolio templates out there, but for this challenge, you'll need to build a portfolio page yourself. Using Bootstrap will make this much easier for you.", - "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'>.", + "Rule #3: You must use both SASS and React to build this project.", + "User Story: I have health, a level, and a weapon. I can pick up a better weapon. I can pick up health items.", + "User Story: All the items and enemies on the map are arranged at random.", + "User Story: I can move throughout a map, discovering items.", + "User Story: I can move anywhere within the map's boundaries , but I can't move through an enemy until I've beaten it.", + "User Story: Much of the map is hidden. When I take a step, all spaces that are within a certain number of space from me are revealed.", + "User Story: When I beat an enemy, the enemy goes away and I get XP, which eventually increases my level.", + "User Story: When I fight an enemy, we take turns damaging each other until one of us loses. I do damage is based off of my level and my weapon. The enemy does damage based off of its level. Damage is somewhat random within a range.", + "User Story: When I find and beat the boss, I win.", + "User Story: The game should be challenging, but theoretically winnable.", "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. ", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." From f1b4875b1108796dc64fdab386a126d28bb348fc Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Tue, 29 Dec 2015 03:20:59 -0600 Subject: [PATCH 119/174] update old ziplines with new forked versions --- .../basic-ziplines.json | 22 ++++++++-------- .../intermediate-ziplines.json | 26 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-ziplines.json b/seed/challenges/01-front-end-development-certification/basic-ziplines.json index f3bd88501e..39da7f228c 100644 --- a/seed/challenges/01-front-end-development-certification/basic-ziplines.json +++ b/seed/challenges/01-front-end-development-certification/basic-ziplines.json @@ -109,7 +109,7 @@ "133315782" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/VemmoX/.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can access all of the portfolio webpage's content just by scrolling.", @@ -132,7 +132,7 @@ "descriptionFr": [], "nameRu": "Создайте сайт-портфолио", "descriptionRu": [ - "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/FreeCodeCamp/full/VemmoX/.", "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", @@ -151,7 +151,7 @@ ], "nameEs": "Construye una página web para tu portafolio", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/ThiagoFerreir4/full/eNMxEp.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/VemmoX/.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", @@ -178,7 +178,7 @@ "126415122" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/AdventureBear/full/vEoVMw.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/yeVgBY.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can click a button to show me a new random quote.", @@ -196,7 +196,7 @@ "descriptionFr": [], "nameRu": "Создайте генератор случайных цитат", "descriptionRu": [ - "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/AdventureBear/full/vEoVMw.", + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/FreeCodeCamp/full/yeVgBY.", "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", @@ -210,7 +210,7 @@ ], "nameEs": "Crea una máquina de frases aleatorias", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/AdventureBear/full/vEoVMw.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/yeVgBY.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", @@ -231,7 +231,7 @@ "126411565" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/zxgaqw.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/EPNZYW.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can add, subtract, multiply and divide two numbers.", @@ -252,7 +252,7 @@ "descriptionRu": [], "nameEs": "Crea una calculadora JavaScript", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/zxgaqw.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/EPNZYW.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", @@ -274,7 +274,7 @@ "126411567" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/RPbGxZ/.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/VemPZX.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can start a 25 minute pomodoro, and the timer will go off once 25 minutes has elapsed.", @@ -293,7 +293,7 @@ "descriptionFr": [], "nameRu": "Создайте таймер Pomodoro", "descriptionRu": [ - "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/GeoffStorbeck/full/RPbGxZ/.", + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/FreeCodeCamp/full/VemPZX.", "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", @@ -307,7 +307,7 @@ ], "nameEs": "Crea un reloj pomodoro", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/RPbGxZ/.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/VemPZX.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", diff --git a/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json b/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json index afdc2bcb00..06cff7be52 100644 --- a/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json +++ b/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json @@ -30,7 +30,7 @@ "descriptionFr": [], "nameRu": "Покажите местную погоду", "descriptionRu": [ - "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/AdventureBear/full/yNBJRj.", + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/FreeCodeCamp/full/avqvgJ.", "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", @@ -69,7 +69,7 @@ "126415129" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/MarufSarker/full/ZGPZLq/.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/pgNRoJ.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can browse recent posts from Camper News.", @@ -91,7 +91,7 @@ "descriptionRu": [], "nameEs": "Adorna las noticias de Camper News", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/MarufSarker/full/ZGPZLq/.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/pgNRoJ.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", @@ -114,7 +114,7 @@ "126415131" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/MwgQea.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/pgNRvJ.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can search Wikipedia entries in a search box and see the resulting Wikipedia entries.", @@ -136,7 +136,7 @@ "descriptionRu": [], "nameEs": "Crea un buscador de Wikipedia", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/MwgQea.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/pgNRvJ.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", @@ -159,13 +159,13 @@ "126411564" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/GeoffStorbeck/full/GJKRxZ.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBpOw.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can see whether Free Code Camp is currently streaming on Twitch.tv.", "User Story: I can click the status output and be sent directly to the Free Code Camp's Twitch.tv channel.", "User Story: if a Twitch user is currently streaming, I can see additional details about what they are streaming.", - "User Story: I will see a placeholder notification if a streamer has closed their Twitch account. You can verify this works by adding brunofin and comster404 to your array of Twitch streamers.", + "User Story: I will see a placeholder notification if a streamer has closed their Twitch account (or the account never existed). You can verify this works by adding brunofin and comster404 to your array of Twitch streamers.", "Hint: See an example call to Twitch.tv's JSONP API at https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Zipline-Use-the-Twitchtv-JSON-API.", "Hint: The relevant documentation about this API call is here: https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streamschannel.", "Hint: Here's an array of the Twitch.tv usernames of people who regularly stream coding: [\"freecodecamp\", \"storbeck\", \"terakilobyte\", \"habathcx\",\"RobotCaleb\",\"thomasballinger\",\"noobs2ninjas\",\"beohoff\"]", @@ -182,7 +182,7 @@ "descriptionFr": [], "nameRu": "Используйте Twitch.tv JSON API", "descriptionRu": [ - "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/GeoffStorbeck/full/GJKRxZ.", + "Задание: Создайте CodePen.io который успешно копирует вот этот: http://codepen.io/FreeCodeCamp/full/adBpOw.", "Правило #1: Не подсматривайте код приведенного на CodePen примера. Напишите его самостоятельно.", "Правило #2: Можете использовать любые библиотеки или API, которые потребуются.", "Правило #3: Воссоздайте функционал приведенного примера и не стесняйтесь добавить что-нибудь от себя.", @@ -201,7 +201,7 @@ ], "nameEs": "Usa el API JSON de Twitch.tv", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/GeoffStorbeck/full/GJKRxZ.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/adBpOw.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", @@ -228,7 +228,7 @@ "126415123" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/alex-dixon/full/JogOpQ/.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBpvw.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can play a game of Tic Tac Toe with the computer.", @@ -250,7 +250,7 @@ "descriptionRu": [], "nameEs": "Crea un juego de Tic Tac Toe", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/alex-dixon/full/JogOpQ/.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/adBpvw.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", @@ -273,7 +273,7 @@ "137213633" ], "description": [ - "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/dting/full/QbRyqq/.", + "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/obYBjE.", "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I am presented with a random series of button presses.", @@ -301,7 +301,7 @@ "descriptionRu": [], "nameEs": "Construye un juego de Simon", "descriptionEs": [ - "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/dting/full/QbRyqq/.", + "Objetivo: Crea una aplicación con CodePen.io que reproduzca efectivamente mediante ingeniería inversa este app: http://codepen.io/FreeCodeCamp/full/obYBjE.", "Regla #1: No veas el código del proyecto de ejemplo en CodePen. Encuentra la forma de hacerlo por tu cuenta.", "Regla #2: Puedes usar cualquier librería o APIs que necesites.", "Regla #3: Usa ingeniería inversa para reproducir la funcionalidad del proyecto de ejemplo, pero también siéntete en la libertad de personalizarlo.", From 474162aa0a5b9957f0160c78f16cc9fc1addd9db Mon Sep 17 00:00:00 2001 From: Waqas Ahmed Date: Tue, 29 Dec 2015 00:02:23 +0400 Subject: [PATCH 120/174] provides clarity about the concept of 'listed order' while specifying multiple classes --- .../html5-and-css.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/html5-and-css.json b/seed/challenges/01-front-end-development-certification/html5-and-css.json index 1661251698..2207ee7d55 100644 --- a/seed/challenges/01-front-end-development-certification/html5-and-css.json +++ b/seed/challenges/01-front-end-development-certification/html5-and-css.json @@ -3539,7 +3539,8 @@ "Create an additional CSS class called blue-text that gives an element the color blue. Make sure it's below your pink-text class declaration.", "Apply the blue-text class to your h1 element in addition to your pink-text class, and let's see which one wins.", "Applying multiple class attributes to a HTML element is done with a space between them like this:", - "class=\"class1 class2\"" + "class=\"class1 class2\"", + "Note: It doesn't matter which order the classes are listed in." ], "tests": [ "assert($(\"h1\").hasClass(\"pink-text\"), 'message: Your h1 element should have the class pink-text.');", @@ -3575,7 +3576,8 @@ "Crea una clase CSS adicional llamada texto-azul que le de a un elemento el color azul. Asegúrate de que está debajo de tu declaración de la clase pink-text. ", "Aplica la clase blue-text a tu elemento h1 además de tu clase pink-text y veamos cual gana.", "La aplicación de múltiples atributos de clase a un elemento HTML se hace usando espacios entre ellos así:", - "class=\"clase1 clase2\"" + "class=\"class1 class2\"", + "Nota: No importa lo que ordenan las clases se enumeran en el." ], "namePt": "", "descriptionPt": [], From e01e28aec3bd2e42a0a4f1bec23e82bbc1cccb6e Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 29 Dec 2015 10:23:57 -0800 Subject: [PATCH 121/174] Fix test solution tail comment collision --- seed/test-challenges.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/seed/test-challenges.js b/seed/test-challenges.js index 71198d83ab..dfb0eb864e 100644 --- a/seed/test-challenges.js +++ b/seed/test-challenges.js @@ -85,7 +85,7 @@ function createTest({ return Observable.just(t) .map(fillAssert) /* eslint-disable no-unused-vars */ - // assert is used within the eval + // assert and code used within the eval .doOnNext(assert => { solutions.forEach(solution => { tests.forEach(test => { @@ -94,7 +94,11 @@ function createTest({ /* eslint-enable no-unused-vars */ try { (() => { - return eval(head + solution + tail + ';;' + test); + return eval( + head + '\n;;' + + solution + '\n;;' + + tail + '\n;;' + + test); })(); } catch (e) { t.fail(e); From b135c9a3920eb8761d6761ec644ca47f9d54eba5 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 29 Dec 2015 10:53:21 -0800 Subject: [PATCH 122/174] Some solution fixes --- .../basic-javascript.json | 44 +++++-------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 562c420d5d..58b810ec54 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3708,7 +3708,7 @@ "})(gloveBoxContents);" ], "solutions": [ - "var myStorage = {\n \"car\": {\n \"inside\": {\n \"glove box\": \"maps\",\n \"passenger seat\": \"crumbs\"\n },\n \"outside\": {\n \"trunk\": \"jack\"\n }\n }\n};\n\nvar gloveBoxContents = myStorage.car.inside[\"glove box\"]; // Change this line" + "var myStorage = { \n \"car\":{ \n \"inside\":{ \n \"glove box\":\"maps\",\n \"passenger seat\":\"crumbs\"\n },\n \"outside\":{ \n \"trunk\":\"jack\"\n }\n }\n};\nvar gloveBoxContents = myStorage.car.inside[\"glove box\"];" ], "type": "waypoint", "challengeType": "1", @@ -3726,7 +3726,7 @@ "Here is an example of how to access a nested array:", "
var ourPets = {
\"cats\": [
\"Meowzer\",
\"Fluffy\",
\"Kit-Cat\"
],
\"dogs:\" [
\"Spot\",
\"Bowser\",
\"Frankie\"
]
};
ourPets.cats[1]; // \"Fluffy\"
ourPets.dogs[0]; // \"Spot\"
", "

Instructions

", - "Retrieve the second tree using object dot and array bracket notation." + "Retrieve the second tree from the variable myPlants using object dot and array bracket notation." ], "releasedOn": "January 1, 2016", "tests": [ @@ -3760,39 +3760,15 @@ "" ], "tail": [ - "" + "(function(x) { ", + " if(typeof x != 'undefined') { ", + " return \"secondTree = \" + x;", + " }", + " return \"secondTree is undefined\";", + "})(secondTree);" ], "solutions": [ - "" - ], - "type": "waypoint", - "challengeType": "1", - "nameCn": "", - "nameFr": "", - "nameRu": "", - "nameEs": "", - "namePt": "" - }, - { - "id": "56533eb9ac21ba0edf2244ce", - "title": "Modifying JSON Values", - "description": [ - "Modify the contents of a JSON object" - ], - "releasedOn": "January 1, 2016", - "tests": [ - "assert(1===1, 'message: message here');" - ], - "challengeSeed": [ - "", - "", - "" - ], - "tail": [ - "" - ], - "solutions": [ - "" + "var myPlants = [\n { \n type: \"flowers\",\n list: [\n \"rose\",\n \"tulip\",\n \"dandelion\"\n ]\n },\n {\n type: \"trees\",\n list: [\n \"fir\",\n \"pine\",\n \"birch\"\n ]\n } \n];\n\n// Only change code below this line\n\nvar secondTree = myPlants[1].list[1];" ], "type": "waypoint", "challengeType": "1", @@ -5063,4 +5039,4 @@ "challengeType": "0" } ] -} \ No newline at end of file +} From 8c3e14cd8e33fc64c880663b51ad81d088073f14 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Mon, 28 Dec 2015 12:41:37 -0800 Subject: [PATCH 123/174] Fix commit redirect for non signed user. Now users will be directed to sign in page and on sign in will have pledge completed --- common/models/user.js | 18 ++++++++++++------ server/boot/commit.js | 11 ++++++++--- server/middlewares/add-return-to.js | 5 +++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/common/models/user.js b/common/models/user.js index 622d5f73f4..9749fba914 100644 --- a/common/models/user.js +++ b/common/models/user.js @@ -1,6 +1,7 @@ import { Observable } from 'rx'; import uuid from 'node-uuid'; import moment from 'moment'; +import dedent from 'dedent'; import debugFactory from 'debug'; import { saveUser, observeMethod } from '../../server/utils/rx'; @@ -91,9 +92,10 @@ module.exports = function(User) { } req.flash('error', { - msg: - `The ${req.body.email} email address is already associated with an account. - Try signing in with it here instead.` + msg: dedent` + The ${req.body.email} email address is already associated with an account. + Try signing in with it here instead. + ` }); return res.redirect('/email-signin'); @@ -171,10 +173,14 @@ module.exports = function(User) { } return req.logIn({ id: accessToken.userId.toString() }, function(err) { - if (err) { - return next(err); - } + if (err) { return next(err); } + debug('user logged in'); + + if (req.session && req.session.returnTo) { + return res.redirect(req.session.returnTo); + } + req.flash('success', { msg: 'Success! You are logged in.' }); return res.redirect('/'); }); diff --git a/server/boot/commit.js b/server/boot/commit.js index 5e613d65fd..dfa8e9a13f 100644 --- a/server/boot/commit.js +++ b/server/boot/commit.js @@ -22,11 +22,16 @@ import { ifNoUserRedirectTo } from '../utils/middleware'; -const sendNonUserToFront = ifNoUserRedirectTo('/'); +const sendNonUserToSignIn = ifNoUserRedirectTo( + '/login', + 'You must be signed in to commit to a non-profit' +); + const sendNonUserToCommit = ifNoUserRedirectTo( '/commit', - 'Must be signed in to update commit' + 'You must be signed in to update commit' ); + const debug = debugFactory('freecc:commit'); function findNonprofit(name) { @@ -52,7 +57,7 @@ export default function commit(app) { router.get( '/commit/pledge', - sendNonUserToFront, + sendNonUserToSignIn, pledge ); diff --git a/server/middlewares/add-return-to.js b/server/middlewares/add-return-to.js index 6771c38481..920f52eafc 100644 --- a/server/middlewares/add-return-to.js +++ b/server/middlewares/add-return-to.js @@ -16,7 +16,8 @@ const pathsWhiteList = [ 'news', 'challenges', 'map', - 'news' + 'news', + 'commit' ]; const pathsOfNoReturnRegex = new RegExp(pathsOfNoReturn.join('|'), 'i'); @@ -35,7 +36,7 @@ export default function addReturnToUrl() { ) { return next(); } - req.session.returnTo = req.path; + req.session.returnTo = req.originalUrl; next(); }; } From 4882c75a30396ac8993afb0aea8eaa851b5d9204 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Thu, 24 Dec 2015 02:39:23 -0800 Subject: [PATCH 124/174] chore(package): update connect-mongo to version 1.1.0 http://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 082b9449ba..78d5e06218 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "cheerio": "~0.19.0", "classnames": "^2.1.2", "compression": "^1.6.0", - "connect-mongo": "~0.8.2", + "connect-mongo": "~1.1.0", "cookie-parser": "^1.4.0", "csso": "^1.4.1", "dateformat": "^1.0.11", From 445008665c90ff7e0cc2ad27fdfef8db150705b0 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 29 Dec 2015 11:18:55 -0800 Subject: [PATCH 125/174] Remove autoReconnect: it is true by default --- server/middlewares/sessions.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server/middlewares/sessions.js b/server/middlewares/sessions.js index fc0e4ccc1b..d0a50a27a8 100644 --- a/server/middlewares/sessions.js +++ b/server/middlewares/sessions.js @@ -9,9 +9,6 @@ export default function sessionsMiddleware() { resave: true, saveUninitialized: true, secret: secrets.sessionSecret, - store: new MongoStore({ - url: secrets.db, - 'autoReconnect': true - }) + store: new MongoStore({ url: secrets.db }) }); } From d745e3a2546df8cf88dad04b5204d7823733fd54 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 29 Dec 2015 11:43:06 -0800 Subject: [PATCH 126/174] Add ability to change message type in middleware util --- server/boot/commit.js | 6 ++++-- server/utils/middleware.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/server/boot/commit.js b/server/boot/commit.js index dfa8e9a13f..37f8559436 100644 --- a/server/boot/commit.js +++ b/server/boot/commit.js @@ -24,12 +24,14 @@ import { const sendNonUserToSignIn = ifNoUserRedirectTo( '/login', - 'You must be signed in to commit to a non-profit' + 'You must be signed in to commit to a nonprofit.', + 'info' ); const sendNonUserToCommit = ifNoUserRedirectTo( '/commit', - 'You must be signed in to update commit' + 'You must be signed in to update commit', + 'info' ); const debug = debugFactory('freecc:commit'); diff --git a/server/utils/middleware.js b/server/utils/middleware.js index f9d4919c9b..1e5243f5da 100644 --- a/server/utils/middleware.js +++ b/server/utils/middleware.js @@ -1,11 +1,11 @@ -export function ifNoUserRedirectTo(url, message) { +export function ifNoUserRedirectTo(url, message, type = 'errors') { return function(req, res, next) { const { path } = req; if (req.user) { return next(); } - req.flash('errors', { + req.flash(type, { msg: message || `You must be signed to go to ${path}` }); From 2a48f4231327aec380f724355ce2f08470d4650e Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 29 Dec 2015 11:57:12 -0800 Subject: [PATCH 127/174] Fix user redirect on email account creation --- server/boot/a-extendUser.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/boot/a-extendUser.js b/server/boot/a-extendUser.js index 25cc14bf0a..b212550a8a 100644 --- a/server/boot/a-extendUser.js +++ b/server/boot/a-extendUser.js @@ -56,9 +56,12 @@ module.exports = function(app) { }); // send welcome email to new camper - User.afterRemote('create', function(ctx, user, next) { + User.afterRemote('create', function({ req, res }, user, next) { debug('user created, sending email'); if (!user.email) { return next(); } + const redirect = req.session && req.session.returnTo ? + req.session.returnTo : + '/'; var mailOptions = { type: 'email', @@ -81,13 +84,13 @@ module.exports = function(app) { debug('sending welcome email'); Email.send(mailOptions, function(err) { if (err) { return next(err); } - ctx.req.logIn(user, function(err) { + req.logIn(user, function(err) { if (err) { return next(err); } - ctx.req.flash('success', { + req.flash('success', { msg: [ "Welcome to Free Code Camp! We've created your account." ] }); - ctx.res.redirect('/'); + res.redirect(redirect); }); }); }); From f236a246900d72e9a0732f413b5d95c4e0be315e Mon Sep 17 00:00:00 2001 From: Vladimir Tamara Date: Tue, 29 Dec 2015 17:47:30 -0500 Subject: [PATCH 128/174] Fixes challenge that requires answer in english and not in spanish --- .../01-front-end-development-certification/bootstrap.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/bootstrap.json b/seed/challenges/01-front-end-development-certification/bootstrap.json index 5a19e0f96c..62df31c257 100644 --- a/seed/challenges/01-front-end-development-certification/bootstrap.json +++ b/seed/challenges/01-front-end-development-certification/bootstrap.json @@ -2294,7 +2294,7 @@ "Cuando comencemos a usar jQuery, modificarmemos los elementos HTML sin necesidad de hacer cambios reales en el código HTML.", "Vamos a asegurarnos de que cualquier persona sepa que no deben modificar nada en este código directamente.", "Recuerda que puedes iniciar un comentario usando <!-- y terminarlo usando -->", - "Agrega un comentario al inicio de tu código HTML que diga No hacer cambios en el código debajo de esta línea." + "Agrega un comentario al inicio de tu código HTML que diga Only change code above this line." ], "namePt": "", "descriptionPt": [] From ab2b80ba2188cf9e2107c74961609026101c1462 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 29 Dec 2015 15:43:21 -0800 Subject: [PATCH 129/174] Solutions for all Challenges --- .../basic-javascript.json | 1522 +++++++++-------- 1 file changed, 811 insertions(+), 711 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 58b810ec54..0e93d4581f 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -19,6 +19,9 @@ "challengeSeed": [ " " ], + "solutions": [ + "// Fake Comment\n/* Another Comment */" + ], "tests": [ "assert(code.match(/(\\/\\/)...../g), 'message: Create a // style comment that contains at least five letters.');", "assert(code.match(/(\\/\\*)[\\w\\W]{5,}(?=\\*\\/)/gm), 'message: Create a /* */ style comment that contains at least five letters.');", @@ -37,10 +40,6 @@ "

Instructions

", "Modify the welcomeToBooleans function so that it returns true instead of false when the run button is clicked." ], - "tests": [ - "assert(typeof(welcomeToBooleans()) === 'boolean', 'message: The welcomeToBooleans() function should return a boolean (true/false) value.');", - "assert(welcomeToBooleans() === true, 'message: welcomeToBooleans() should return true.');" - ], "challengeSeed": [ "function welcomeToBooleans() {", "", @@ -54,6 +53,13 @@ "tail": [ "welcomeToBooleans();" ], + "solutions": [ + "function welcomeToBooleans() {\n return true; // Change this line\n}" + ], + "tests": [ + "assert(typeof(welcomeToBooleans()) === 'boolean', 'message: The welcomeToBooleans() function should return a boolean (true/false) value.');", + "assert(welcomeToBooleans() === true, 'message: welcomeToBooleans() should return true.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -70,9 +76,6 @@ "Hint", "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;}})(), 'message: myName should be a string that contains at least one character in it.');" - ], "challengeSeed": [ "// Example", "var ourName = \"Free Code Camp\";", @@ -83,6 +86,12 @@ "tail": [ "if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}" ], + "solutions": [ + "var myName = \"Test Testerson\";" + ], + "tests": [ + "assert((function(){if(typeof(myName) !== \"undefined\" && typeof(myName) === \"string\" && myName.length > 0){return true;}else{return false;}})(), 'message: myName should be a string that contains at least one character in it.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -102,12 +111,6 @@ "Assign the contents of a to variable b." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(/var a;/.test(code) && /var b = 2;/.test(code), 'message: Do not change code above the line');", - "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", - "assert(typeof b === 'number' && b === 7, 'message: b should have a value of 7');", - "assert(/b\\s*=\\s*a\\s*;/g.test(code) > 0, 'message: a should be assigned to b with =');" - ], "challengeSeed": [ "// Setup", "var a;", @@ -122,6 +125,12 @@ "solutions": [ "var a;\nvar b = 2;\na = 7;\nb = a;" ], + "tests": [ + "assert(/var a;/.test(code) && /var b = 2;/.test(code), 'message: Do not change code above the line');", + "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", + "assert(typeof b === 'number' && b === 7, 'message: b should have a value of 7');", + "assert(/b\\s*=\\s*a\\s*;/g.test(code) > 0, 'message: a should be assigned to b with =');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -143,9 +152,6 @@ "Define a variable a with var and initialize it to a value of 9." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(/var\\s+a\\s*=\\s*9\\s*/.test(code), 'message: Initialize a to a value of 9');" - ], "challengeSeed": [ "// Example", "var ourVar = 19;", @@ -159,6 +165,9 @@ "solutions": [ "var a = 9;" ], + "tests": [ + "assert(/var\\s+a\\s*=\\s*9\\s*/.test(code), 'message: Initialize a to a value of 9');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -176,12 +185,6 @@ "Initialize the three variables a, b, and c with 5, 10, and \"I am a\" respectively so that they will not be undefined." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof a === 'number' && a === 6, 'message: a should be defined and have a value of 6');", - "assert(typeof b === 'number' && b === 15, 'message: b should be defined and have a value of 15');", - "assert(!/undefined/.test(c) && c === \"I am a String!\", 'message: c should not contain undefined and should have a value of \"I am a String!\"');", - "assert(/a = a \\+ 1;/.test(code) && /b = b \\+ 5;/.test(code) && /c = c \\+ \" String!\";/.test(code), 'message: Do not change code below the line');" - ], "challengeSeed": [ "// Initialize these three variables", "var a;", @@ -201,6 +204,12 @@ "solutions": [ "var a = 5;\nvar b = 10;\nvar c = \"I am a\";\na = a + 1;\nb = b + 5;\nc = c + \" String!\";" ], + "tests": [ + "assert(typeof a === 'number' && a === 6, 'message: a should be defined and have a value of 6');", + "assert(typeof b === 'number' && b === 15, 'message: b should be defined and have a value of 15');", + "assert(!/undefined/.test(c) && c === \"I am a String!\", 'message: c should not contain undefined and should have a value of \"I am a String!\"');", + "assert(/a = a \\+ 1;/.test(code) && /b = b \\+ 5;/.test(code) && /c = c \\+ \" String!\";/.test(code), 'message: Do not change code below the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -223,11 +232,6 @@ "Correct the variable assignments so their names match their variable declarations above." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(StUdLyCapVaR === 10, 'message: StUdLyCapVaR has the correct case');", - "assert(properCamelCase === \"A String\", 'message: properCamelCase has the correct case');", - "assert(TitleCaseOver === 9000, 'message: TitleCaseOver has the correct case');" - ], "challengeSeed": [ "// Setup", "var StUdLyCapVaR;", @@ -244,6 +248,11 @@ "solutions": [ "var StUdLyCapVaR;\nvar properCamelCase;\nvar TitleCaseOver;\n\nStUdLyCapVaR = 10;\nproperCamelCase = \"A String\";\nTitleCaseOver = 9000;" ], + "tests": [ + "assert(StUdLyCapVaR === 10, 'message: StUdLyCapVaR has the correct case');", + "assert(properCamelCase === \"A String\", 'message: properCamelCase has the correct case');", + "assert(TitleCaseOver === 9000, 'message: TitleCaseOver has the correct case');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -266,10 +275,6 @@ "

Instructions

", "Change the 0 so that sum will equal 20." ], - "tests": [ - "assert(sum === 20, 'message: sum should equal 20');", - "assert(/\\+/.test(code), 'message: Use the + operator');" - ], "challengeSeed": [ "var sum = 10 + 0;", "" @@ -277,6 +282,13 @@ "tail": [ "(function(z){return 'sum='+z;})(sum);" ], + "solutions": [ + "var sum = 10 + 10;" + ], + "tests": [ + "assert(sum === 20, 'message: sum should equal 20');", + "assert(/\\+/.test(code), 'message: Use the + operator');" + ], "type": "waypoint", "challengeType": "1" }, @@ -293,10 +305,6 @@ "

Instructions

", "Change the 0 so the difference is 12." ], - "tests": [ - "assert(difference === 12, 'message: Make the variable difference equal 12.');", - "assert(/\\d+\\s*-\\s*\\d+/.test(code),'message: User the - operator');" - ], "challengeSeed": [ "var difference = 45 - 0;", "", @@ -308,6 +316,10 @@ "solutions": [ "var difference = 45 - 33;" ], + "tests": [ + "assert(difference === 12, 'message: Make the variable difference equal 12.');", + "assert(/\\d+\\s*-\\s*\\d+/.test(code),'message: User the - operator');" + ], "type": "waypoint", "challengeType": "1" }, @@ -324,10 +336,6 @@ "

Instructions

", "Change the 0 so that product will equal 80." ], - "tests": [ - "assert(product === 80,'message: Make the variable product equal 80');", - "assert(/\\*/.test(code), 'message: Use the * operator');" - ], "challengeSeed": [ "var product = 8 * 0;", "", @@ -339,6 +347,10 @@ "solutions": [ "var product = 8 * 10;" ], + "tests": [ + "assert(product === 80,'message: Make the variable product equal 80');", + "assert(/\\*/.test(code), 'message: Use the * operator');" + ], "type": "waypoint", "challengeType": "1" }, @@ -355,10 +367,6 @@ "

Instructions

", "Change the 0 so that the quotient is equal to 2." ], - "tests": [ - "assert(quotient === 2, 'message: Make the variable quotient equal to 2.');", - "assert(/\\d+\\s*\\/\\s*\\d+/.test(code), 'message: Use the / operator');" - ], "challengeSeed": [ "var quotient = 66 / 0;", "", @@ -367,6 +375,13 @@ "tail": [ "(function(z){return 'quotient = '+z;})(quotient);" ], + "solutions": [ + "var quotient = 66 / 33;" + ], + "tests": [ + "assert(quotient === 2, 'message: Make the variable quotient equal to 2.');", + "assert(/\\d+\\s*\\/\\s*\\d+/.test(code), 'message: Use the / operator');" + ], "type": "waypoint", "challengeType": "1" }, @@ -382,11 +397,6 @@ "Change the code to use the ++ operator on myVar" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myVar === 88, 'message: myVar should equal 88');", - "assert(/[+]{2}/.test(code), 'message: Use the ++ operator');", - "assert(/var myVar = 87;/.test(code), 'message: Do not change code above the line');" - ], "challengeSeed": [ "var myVar = 87;", "", @@ -400,6 +410,11 @@ "solutions": [ "var myVar = 87;\nmyVar++;" ], + "tests": [ + "assert(myVar === 88, 'message: myVar should equal 88');", + "assert(/[+]{2}/.test(code), 'message: Use the ++ operator');", + "assert(/var myVar = 87;/.test(code), 'message: Do not change code above the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -420,11 +435,6 @@ "Change the code to use the -- operator on myVar" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myVar === 10, 'message: myVar should equal 10');", - "assert(/myVar[-]{2}/.test(code), 'message: Use the -- operator on myVar');", - "assert(/var myVar = 11;/.test(code), 'message: Do not change code above the line');" - ], "challengeSeed": [ "var myVar = 11;", "", @@ -438,6 +448,11 @@ "solutions": [ "var myVar = 11;\nmyVar--;" ], + "tests": [ + "assert(myVar === 10, 'message: myVar should equal 10');", + "assert(/myVar[-]{2}/.test(code), 'message: Use the -- operator on myVar');", + "assert(/var myVar = 11;/.test(code), 'message: Do not change code above the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -456,10 +471,6 @@ "

Instructions

", "Create a variable myDecimal and give it a decimal value." ], - "tests": [ - "assert(typeof myDecimal === \"number\", 'message: myDecimal should be a number.');", - "assert(code.match(/\\d+\\.\\d+/g).length >= 2, 'message: myDecimal should have a decimal point'); " - ], "challengeSeed": [ "var ourDecimal = 5.7;", "", @@ -468,7 +479,14 @@ "" ], "tail": [ - "(function(){if(typeof(myDecimal) !== \"undefined\"){return myDecimal;}})();" + "(function(){if(typeof myDecimal !== \"undefined\"){return myDecimal;}})();" + ], + "solutions": [ + "var myDecimal = 9.9;" + ], + "tests": [ + "assert(typeof myDecimal === \"number\", 'message: myDecimal should be a number.');", + "assert(myDecimal % 1 != 0, 'message: myDecimal should have a decimal point'); " ], "type": "waypoint", "challengeType": "1" @@ -482,18 +500,21 @@ "

Instructions

", "Change the 0.0 so that product will equal 5.0." ], - "tests": [ - "assert(product === 5.0, 'message: The variable product should equal 5.0.');", - "assert(/\\*/.test(code), 'message: You should use the * operator');" - ], - "tail": [ - "(function(y){return 'product = '+y;})(product);" - ], "challengeSeed": [ "var product = 2.0 * 0.0;", "", "" ], + "tail": [ + "(function(y){return 'product = '+y;})(product);" + ], + "solutions": [ + "var product = 2.0 * 2.5;" + ], + "tests": [ + "assert(product === 5.0, 'message: The variable product should equal 5.0.');", + "assert(/\\*/.test(code), 'message: You should use the * operator');" + ], "type": "waypoint", "challengeType": "1" }, @@ -505,10 +526,6 @@ "

Instructions

", "Change the 0.0 so that quotient will equal to 2.2." ], - "tests": [ - "assert(quotient === 2.2, 'message: The variable quotient should equal 2.2.');", - "assert(/\\//.test(code), 'message: You should use the / operator');" - ], "challengeSeed": [ "var quotient = 0.0 / 2.0;", "", @@ -517,6 +534,13 @@ "tail": [ "(function(y){return 'quotient = '+y;})(quotient);" ], + "solutions": [ + "var quotient = 4.4 / 2.0;" + ], + "tests": [ + "assert(quotient === 2.2, 'message: The variable quotient should equal 2.2.');", + "assert(/\\//.test(code), 'message: You should use the / operator');" + ], "type": "waypoint", "challengeType": "1" }, @@ -536,10 +560,6 @@ "Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(remainder === 2, 'message: The value of remainder should be 2');", - "assert(/\\d+\\s*%\\s*\\d+/.test(code), 'message: You should use the % operator');" - ], "challengeSeed": [ "// Only change code below this line", "", @@ -552,6 +572,10 @@ "solutions": [ "var remainder = 11 % 3;" ], + "tests": [ + "assert(remainder === 2, 'message: The value of remainder should be 2');", + "assert(/\\d+\\s*%\\s*\\d+/.test(code), 'message: You should use the % operator');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -573,13 +597,6 @@ "Convert the assignments for a, b, and c to use the += operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(a === 15, 'message: a should equal 15');", - "assert(b === 26, 'message: b should equal 26');", - "assert(c === 19, 'message: c should equal 19');", - "assert(code.match(/\\+=/g).length === 3, 'message: You should use the += operator for each variable');", - "assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code), 'message: Do not modify the code above the line');" - ], "challengeSeed": [ "var a = 3;", "var b = 17;", @@ -598,6 +615,13 @@ "solutions": [ "var a = 3;\nvar b = 17;\nvar c = 12;\n\na += 12;\nb += 9;\nc += 7;" ], + "tests": [ + "assert(a === 15, 'message: a should equal 15');", + "assert(b === 26, 'message: b should equal 26');", + "assert(c === 19, 'message: c should equal 19');", + "assert(code.match(/\\+=/g).length === 3, 'message: You should use the += operator for each variable');", + "assert(/var a = 3;/.test(code) && /var b = 17;/.test(code) && /var c = 12;/.test(code), 'message: Do not modify the code above the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -618,13 +642,6 @@ "Convert the assignments for a, b, and c to use the -= operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(a === 5, 'message: a should equal 5');", - "assert(b === -6, 'message: b should equal -6');", - "assert(c === 2, 'message: c should equal 2');", - "assert(code.match(/-=/g).length === 3, 'message: You should use the -= operator for each variable');", - "assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), 'message: Do not modify the code above the line');" - ], "challengeSeed": [ "var a = 11;", "var b = 9;", @@ -644,6 +661,13 @@ "solutions": [ "var a = 11;\nvar b = 9;\nvar c = 3;\n\na -= 6;\nb -= 15;\nc -= 1;\n\n" ], + "tests": [ + "assert(a === 5, 'message: a should equal 5');", + "assert(b === -6, 'message: b should equal -6');", + "assert(c === 2, 'message: c should equal 2');", + "assert(code.match(/-=/g).length === 3, 'message: You should use the -= operator for each variable');", + "assert(/var a = 11;/.test(code) && /var b = 9;/.test(code) && /var c = 3;/.test(code), 'message: Do not modify the code above the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -664,13 +688,6 @@ "Convert the assignments for a, b, and c to use the *= operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(a === 25, 'message: a should equal 25');", - "assert(b === 36, 'message: b should equal 36');", - "assert(c === 46, 'message: c should equal 46');", - "assert(code.match(/\\*=/g).length === 3, 'message: You should use the *= operator for each variable');", - "assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\\.6;/.test(code), 'message: Do not modify the code above the line');" - ], "challengeSeed": [ "var a = 5;", "var b = 12;", @@ -690,6 +707,13 @@ "solutions": [ "var a = 5;\nvar b = 12;\nvar c = 4.6;\n\na *= 5;\nb *= 3;\nc *= 10;" ], + "tests": [ + "assert(a === 25, 'message: a should equal 25');", + "assert(b === 36, 'message: b should equal 36');", + "assert(c === 46, 'message: c should equal 46');", + "assert(code.match(/\\*=/g).length === 3, 'message: You should use the *= operator for each variable');", + "assert(/var a = 5;/.test(code) && /var b = 12;/.test(code) && /var c = 4\\.6;/.test(code), 'message: Do not modify the code above the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -710,13 +734,6 @@ "Convert the assignments for a, b, and c to use the /= operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(a === 4, 'message: a should equal 4');", - "assert(b === 27, 'message: b should equal 27');", - "assert(c === 3, 'message: c should equal 3');", - "assert(code.match(/\\/=/g).length === 3, 'message: You should use the /= operator for each variable');", - "assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code), 'message: Do not modify the code above the line');" - ], "challengeSeed": [ "var a = 48;", "var b = 108;", @@ -735,6 +752,13 @@ "solutions": [ "var a = 48;\nvar b = 108;\nvar c = 33;\n\na /= 12;\nb /= 4;\nc /= 11;" ], + "tests": [ + "assert(a === 4, 'message: a should equal 4');", + "assert(b === 27, 'message: b should equal 27');", + "assert(c === 3, 'message: c should equal 3');", + "assert(code.match(/\\/=/g).length === 3, 'message: You should use the /= operator for each variable');", + "assert(/var a = 48;/.test(code) && /var b = 108;/.test(code) && /var c = 33;/.test(code), 'message: Do not modify the code above the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -752,14 +776,6 @@ "You are given a variable Tc representing a temperature in Celsius. Create a variable Tf and apply the algorithm to assign it the corresponding temperature in Fahrenheit." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof convert(0) === 'number', 'message: convert(0) should return a number');", - "assert(convert(-30) === -22, 'message: convert(-30) should return a value of -22');", - "assert(convert(-10) === 14, 'message: convert(-10) should return a value of 14');", - "assert(convert(0) === 32, 'message: convert(0) should return a value of 32');", - "assert(convert(20) === 68, 'message: convert(20) should return a value of 68');", - "assert(convert(30) === 86, 'message: convert(30) should return a value of 86');" - ], "challengeSeed": [ "function convert(Tc) {", " // Only change code below this line", @@ -779,6 +795,14 @@ "solutions": [ "function convert(Tc) {\n var Tf = Tc * 9/5 + 32;\n if(typeof Tf !== 'undefined') {\n return Tf;\n } else {\n return \"Tf not defined\";\n }\n}" ], + "tests": [ + "assert(typeof convert(0) === 'number', 'message: convert(0) should return a number');", + "assert(convert(-30) === -22, 'message: convert(-30) should return a value of -22');", + "assert(convert(-10) === 14, 'message: convert(-10) should return a value of 14');", + "assert(convert(0) === 32, 'message: convert(0) should return a value of 32');", + "assert(convert(20) === 68, 'message: convert(20) should return a value of 68');", + "assert(convert(30) === 86, 'message: convert(30) should return a value of 86');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -797,10 +821,6 @@ "

Instructions

", "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;}})(), 'message: 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;}})(), 'message: myLastName should be a string with at least one character in it.');" - ], "challengeSeed": [ "// Example", "var firstName = \"Alan\";", @@ -817,6 +837,10 @@ "solutions": [ "var myFirstName = \"Alan\";\nvar myLastName = \"Turing\";" ], + "tests": [ + "assert((function(){if(typeof(myFirstName) !== \"undefined\" && typeof(myFirstName) === \"string\" && myFirstName.length > 0){return true;}else{return false;}})(), 'message: 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;}})(), 'message: myLastName should be a string with at least one character in it.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -833,9 +857,6 @@ "\"I am a \"double quoted\" string inside \"double quotes\"\"" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(code.match(/\\\\\"/g).length === 4 && code.match(/[^\\\\]\"/g).length === 2, 'message: You should use two double quotes (") and four escaped double quotes (\") ');" - ], "challengeSeed": [ "var myStr; // Change this line", "", @@ -844,6 +865,9 @@ "solutions": [ "var myStr = \"I am a \\\"double quoted\\\" string inside \\\"double quotes\\\"\";" ], + "tests": [ + "assert(code.match(/\\\\\"/g).length === 4 && code.match(/[^\\\\]\"/g).length === 2, 'message: You should use two double quotes (") and four escaped double quotes (\") ');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -864,11 +888,6 @@ "Change the provided string from double to single quotes and remove the escaping." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(!/\\\\/g.test(code), 'message: Remove all the backslashes (\\)');", - "assert(code.match(/\"/g).length === 4 && code.match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "');", - "assert(myStr === 'Link', 'message: Only remove the backslashes \\ used to escape quotes.');" - ], "challengeSeed": [ "var myStr = \"Link\";", "", @@ -880,6 +899,11 @@ "solutions": [ "var myStr = 'Link';" ], + "tests": [ + "assert(!/\\\\/g.test(code), 'message: Remove all the backslashes (\\)');", + "assert(code.match(/\"/g).length === 4 && code.match(/'/g).length === 2, 'message: You should have two single quotes ' and four double quotes "');", + "assert(myStr === 'Link', 'message: Only remove the backslashes \\ used to escape quotes.');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -899,9 +923,6 @@ "Encode the following sequence, separated by spaces:
backslash tab tab carriage-return new-line and assign it to myStr" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myStr === \"\\\\ \\t \\t \\r \\n\", 'message: myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces');" - ], "challengeSeed": [ "var myStr; // Change this line", "", @@ -910,6 +931,9 @@ "solutions": [ "var myStr = \"\\\\ \\t \\t \\r \\n\";" ], + "tests": [ + "assert(myStr === \"\\\\ \\t \\t \\r \\n\", 'message: myStr should have the escape sequences for backslash tab tab carriage-return new-line separated by spaces');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -929,10 +953,6 @@ "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end.');", - "assert(code.match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" - ], "challengeSeed": [ "// Example", "var ourStr = \"I come first. \" + \"I come second.\";", @@ -946,6 +966,10 @@ "solutions": [ "var ourStr = \"I come first. \" + \"I come second.\";\nvar myStr = \"This is the start. \" + \"This is the end.\";" ], + "tests": [ + "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end.');", + "assert(code.match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -963,10 +987,6 @@ "Build myStr over several lines by concatenating these two strings:
\"This is the first sentance. \" and \"This is the second sentance.\" using the += operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myStr === \"This is the first sentance. This is the second sentance.\", 'message: myStr should have a value of This is the first sentance. This is the second sentance.');", - "assert(code.match(/\\w\\s*\\+=\\s*\"/g).length > 1 && code.match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" - ], "challengeSeed": [ "// Example", "var ourStr = \"I come first. \";", @@ -981,6 +1001,10 @@ "solutions": [ "var ourStr = \"I come first. \";\nourStr += \"I come second.\";\n\nvar myStr = \"This is the first sentance. \";\nmyStr += \"This is the second sentance.\";" ], + "tests": [ + "assert(myStr === \"This is the first sentance. This is the second sentance.\", 'message: myStr should have a value of This is the first sentance. This is the second sentance.');", + "assert(code.match(/\\w\\s*\\+=\\s*\"/g).length > 1 && code.match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -998,10 +1022,6 @@ "Set myName and build myStr with myName between the strings \"My name is \" and \" and I am swell!\"" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof myName !== 'undefined' && myName.length > 2, 'message: myName should be set to a string at least 3 characters long');", - "assert(code.match(/\"\\s*\\+\\s*myName\\s*\\+\\s*\"/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" - ], "challengeSeed": [ "// Example", "var ourName = \"Free Code Camp\";", @@ -1016,6 +1036,10 @@ "solutions": [ "var myName = \"Bob\";\nvar myStr = \"My name is \" + myName + \" and I am swell!\";" ], + "tests": [ + "assert(typeof myName !== 'undefined' && myName.length > 2, 'message: myName should be set to a string at least 3 characters long');", + "assert(code.match(/\"\\s*\\+\\s*myName\\s*\\+\\s*\"/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -1033,10 +1057,6 @@ "Set someAdjective and append it to myStr using the += operator." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, 'message: someAdjective should be set to a string at least 3 characters long');", - "assert(code.match(/\\w\\s*\\+=\\s*someAdjective\\s*;/).length > 0, 'message: Append someAdjective to myStr using the += operator');" - ], "challengeSeed": [ "// Example", "var anAdjective = \"awesome!\";", @@ -1052,6 +1072,10 @@ "solutions": [ "var anAdjective = \"awesome!\";\nvar ourStr = \"Free Code Camp is \";\nourStr += anAdjective;\n\nvar someAdjective = \"neat\";\nvar myStr = \"Learning to code is \";\nmyStr += someAdjective;" ], + "tests": [ + "assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, 'message: someAdjective should be set to a string at least 3 characters long');", + "assert(code.match(/\\w\\s*\\+=\\s*someAdjective\\s*;/).length > 0, 'message: Append someAdjective to myStr using the += operator');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -1070,10 +1094,6 @@ "

Instructions

", "Use the .length property to count the number of characters in the lastName variable and assign it to lastNameLength." ], - "tests": [ - "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'message: lastNameLength should be equal to eight.');", - "assert((function(){if(code.match(/\\.length/gi) && code.match(/\\.length/gi).length >= 2 && code.match(/var lastNameLength \\= 0;/gi) && code.match(/var lastNameLength \\= 0;/gi).length >= 1){return true;}else{return false;}})(), 'message: You should be getting the length of lastName by using .length like this: lastName.length.');" - ], "challengeSeed": [ "// Example", "var firstNameLength = 0;", @@ -1094,7 +1114,13 @@ "tail": [ "if(typeof(lastNameLength) !== \"undefined\"){(function(){return lastNameLength;})();}" ], - "solution": "var lastNameLength = 0;\nvar lastName = \"Lovelace\";\nlastNameLength = lastName.length;", + "solutions": [ + "var firstNameLength = 0;\nvar firstName = \"Ada\";\nfirstNameLength = firstName.length;\n\nvar lastNameLength = 0;\nvar lastName = \"Lovelace\";\nlastNameLength = lastName.length;" + ], + "tests": [ + "assert((function(){if(typeof(lastNameLength) !== \"undefined\" && typeof(lastNameLength) === \"number\" && lastNameLength === 8){return true;}else{return false;}})(), 'message: lastNameLength should be equal to eight.');", + "assert((function(){if(code.match(/\\.length/gi) && code.match(/\\.length/gi).length >= 2 && code.match(/var lastNameLength \\= 0;/gi) && code.match(/var lastNameLength \\= 0;/gi).length >= 1){return true;}else{return false;}})(), 'message: You should be getting the length of lastName by using .length like this: lastName.length.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1110,9 +1136,6 @@ "Hint", "
Try looking at the firstLetterOfFirstName variable declaration if you get stuck." ], - "tests": [ - "assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && code.match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" - ], "challengeSeed": [ "// Example", "var firstLetterOfFirstName = \"\";", @@ -1134,6 +1157,9 @@ "solutions": [ "var firstLetterOfLastName = \"\";\nvar lastName = \"Lovelace\";\n\n// Only change code below this line\nfirstLetterOfLastName = lastName[0];" ], + "tests": [ + "assert((function(){if(typeof(firstLetterOfLastName) !== \"undefined\" && code.match(/\\[0\\]/gi) && typeof(firstLetterOfLastName) === \"string\" && firstLetterOfLastName === \"L\"){return true;}else{return false;}})(), 'message: The firstLetterOfLastName variable should have the value of L.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1150,13 +1176,6 @@ "Correct the assignment to myStr to achieve the desired effect." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myStr === \"Hello World\", 'message: myStr should have a value of Hello World');", - "assert(/myStr = \"Jello World\"/.test(code), 'message: Do not change the code above the line');" - ], - "tail": [ - "(function(v){return \"myStr = \" + v;})(myStr);" - ], "challengeSeed": [ "// Setup", "var myStr = \"Jello World\";", @@ -1167,9 +1186,16 @@ "", "" ], + "tail": [ + "(function(v){return \"myStr = \" + v;})(myStr);" + ], "solutions": [ "var myStr = \"Jello World\";\nmyStr = \"Hello World\";" ], + "tests": [ + "assert(myStr === \"Hello World\", 'message: myStr should have a value of Hello World');", + "assert(/myStr = \"Jello World\"/.test(code), 'message: Do not change the code above the line');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -1189,9 +1215,6 @@ "Hint", "
Try looking at the secondLetterOfFirstName variable declaration if you get stuck." ], - "tests": [ - "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');" - ], "challengeSeed": [ "// Example", "var firstName = \"Ada\";", @@ -1211,6 +1234,9 @@ "solutions": [ "var lastName = \"Lovelace\";\nvar thirdLetterOfLastName = lastName[2];" ], + "tests": [ + "assert(thirdLetterOfLastName === 'v', 'message: The thirdLetterOfLastName variable should have the value of v.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1225,10 +1251,6 @@ "Hint", "
Try looking at the lastLetterOfFirstName variable declaration if you get stuck." ], - "tests": [ - "assert(lastLetterOfLastName === \"e\", 'message: lastLetterOfLastName should be \"e\".');", - "assert(code.match(/\\.length/g).length === 2, 'message: You have to use .length to get the last letter.');" - ], "challengeSeed": [ "// Example", "var firstName = \"Ada\";", @@ -1248,6 +1270,10 @@ "solutions": [ "var firstName = \"Ada\";\nvar lastLetterOfFirstName = firstName[firstName.length - 1];\n\nvar lastName = \"Lovelace\";\nvar lastLetterOfLastName = lastName[lastName.length - 1];" ], + "tests": [ + "assert(lastLetterOfLastName === \"e\", 'message: lastLetterOfLastName should be \"e\".');", + "assert(code.match(/\\.length/g).length === 2, 'message: You have to use .length to get the last letter.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1262,10 +1288,6 @@ " Hint", "
Try looking at the thirdToLastLetterOfFirstName variable declaration if you get stuck." ], - "tests": [ - "assert(secondToLastLetterOfLastName === 'c', 'message: secondToLastLetterOfLastName should be \"c\".');", - "assert(code.match(/\\.length/g).length === 2, 'message: You have to use .length to get the second last letter.');" - ], "challengeSeed": [ "// Example", "var firstName = \"Ada\";", @@ -1285,6 +1307,10 @@ "solutions": [ "var firstName = \"Ada\";\nvar thirdToLastLetterOfFirstName = firstName[firstName.length - 3];\n\nvar lastName = \"Lovelace\";\nvar secondToLastLetterOfLastName = lastName[lastName.length - 2];" ], + "tests": [ + "assert(secondToLastLetterOfLastName === 'c', 'message: secondToLastLetterOfLastName should be \"c\".');", + "assert(code.match(/\\.length/g).length === 2, 'message: You have to use .length to get the second last letter.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1298,12 +1324,6 @@ "The tests will run your function with several different inputs to make sure it works properly." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string');", - "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 30, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 30 characters with empty inputs');", - "assert(/dog/.test(test1) && /big/.test(test1) && /ran/.test(test1) && /quickly/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words.');", - "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" - ], "challengeSeed": [ "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {", " var result = \"\";", @@ -1324,6 +1344,12 @@ "solutions": [ "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {\n var result = \"\";\n\n result = \"Once there was a \" + myNoun + \" which was very \" + myAdjective + \". \";\n result += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";\n\n return result;\n}" ], + "tests": [ + "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string');", + "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 30, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 30 characters with empty inputs');", + "assert(/dog/.test(test1) && /big/.test(test1) && /ran/.test(test1) && /quickly/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words.');", + "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -1343,11 +1369,6 @@ "Hint", "
Refer to the example code in the text editor if you get stuck." ], - "tests": [ - "assert(typeof(myArray) == 'object', 'message: myArray should be an array.');", - "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'message: The first item in myArray should be a string.');", - "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'message: The second item in myArray should be a number.');" - ], "challengeSeed": [ "// Example", "var array = [\"John\", 23];", @@ -1362,6 +1383,11 @@ "solutions": [ "var myArray = [\"The Answer\", 42];" ], + "tests": [ + "assert(typeof(myArray) == 'object', 'message: myArray should be an array.');", + "assert(typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) == 'string', 'message: The first item in myArray should be a string.');", + "assert(typeof(myArray[1]) !== 'undefined' && typeof(myArray[1]) == 'number', 'message: The second item in myArray should be a number.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1373,9 +1399,6 @@ "

Instructions

", "Create a nested array called myArray." ], - "tests": [ - "assert(Array.isArray(myArray) && myArray.some(Array.isArray), 'message: myArray should have at least one array nested within another array.');" - ], "challengeSeed": [ "// Example", "var ourArray = [[\"the universe\", \"everything\", 42]];", @@ -1390,6 +1413,9 @@ "solutions": [ "var myArray = [[1,2,3]];" ], + "tests": [ + "assert(Array.isArray(myArray) && myArray.some(Array.isArray), 'message: myArray should have at least one array nested within another array.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1404,9 +1430,6 @@ "

Instructions

", "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;}})(), 'message: The variable myData should equal the first value of myArray.');" - ], "challengeSeed": [ "// Example", "var ourArray = [1,2,3];", @@ -1424,6 +1447,9 @@ "solutions": [ "var myArray = [1,2,3];\nvar myData = myArray[0];" ], + "tests": [ + "assert((function(){if(typeof(myArray) != 'undefined' && typeof(myData) != 'undefined' && myArray[0] == myData){return true;}else{return false;}})(), 'message: The variable myData should equal the first value of myArray.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1437,10 +1463,6 @@ "

Instructions

", "Modify the data stored at index 0 of myArray to a value of 3." ], - "tests": [ - "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: myArray should now be [3,2,3].');", - "assert((function(){if(code.match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'message: You should be using correct index to modify the value in myArray.');" - ], "challengeSeed": [ "// Example", "var ourArray = [1,2,3];", @@ -1459,6 +1481,10 @@ "solutions": [ "var myArray = [1,2,3];\nmyArray[0] = 3;" ], + "tests": [ + "assert((function(){if(typeof(myArray) != 'undefined' && myArray[0] == 3 && myArray[1] == 2 && myArray[2] == 3){return true;}else{return false;}})(), 'message: myArray should now be [3,2,3].');", + "assert((function(){if(code.match(/myArray\\[0\\]\\s?=\\s?/g)){return true;}else{return false;}})(), 'message: You should be using correct index to modify the value in myArray.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1473,10 +1499,6 @@ "Read from myArray using bracket notation so that myData is equal to 8" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myData === 8, 'message: myData should be equal to 8.');", - "assert(/myArray\\[2\\]\\[1\\]/g.test(code), 'message: You should be using bracket notation to read the value from myArray.');" - ], "challengeSeed": [ "// Setup", "var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];", @@ -1491,6 +1513,10 @@ "solutions": [ "var myArray = [[1,2,3],[4,5,6], [7,8,9], [[10,11,12], 13, 14]];\nvar myData = myArray[2][1];" ], + "tests": [ + "assert(myData === 8, 'message: myData should be equal to 8.');", + "assert(/myArray\\[2\\]\\[1\\]/g.test(code), 'message: You should be using bracket notation to read the value from myArray.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1506,9 +1532,6 @@ "

Instructions

", "Push [\"dog\", 3] onto the end of the myArray variable." ], - "tests": [ - "assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" - ], "challengeSeed": [ "// Example", "var ourArray = [\"Stimpson\", \"J\", \"cat\"];", @@ -1528,6 +1551,9 @@ "solutions": [ "var myArray = [[\"John\", 23], [\"cat\", 2]];\nmyArray.push([\"dog\",3]);" ], + "tests": [ + "assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1542,10 +1568,6 @@ "

Instructions

", "Use the .pop() function to remove the last item from myArray, assigning the \"popped off\" value to removedFromMyArray." ], - "tests": [ - "assert((function(d){if(d[0][0] == 'John' && d[0][1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should only contain [[\"John\", 23]].');", - "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should only contain [\"cat\", 2].');" - ], "challengeSeed": [ "// Example", "var ourArray = [1,2,3];", @@ -1566,6 +1588,10 @@ "solutions": [ "var myArray = [[\"John\", 23], [\"cat\", 2]];\nvar removedFromMyArray = myArray.pop();" ], + "tests": [ + "assert((function(d){if(d[0][0] == 'John' && d[0][1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should only contain [[\"John\", 23]].');", + "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should only contain [\"cat\", 2].');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1578,10 +1604,6 @@ "

Instructions

", "Use the .shift() function to remove the first item from myArray, assigning the \"shifted off\" value to removedFromMyArray." ], - "tests": [ - "assert((function(d){if(d[0][0] == 'dog' && d[0][1] == 3 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"dog\", 3]].');", - "assert((function(d){if(d[0] === 'John' && d[1] === 23 && typeof(removedFromMyArray) === 'object'){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should contain [\"John\", 23].');" - ], "challengeSeed": [ "// Example", "var ourArray = [\"Stimpson\", \"J\", [\"cat\"]];", @@ -1602,6 +1624,10 @@ "solutions": [ "var myArray = [[\"John\", 23], [\"dog\", 3]];\n\n// Only change code below this line.\nvar removedFromMyArray = myArray.shift();" ], + "tests": [ + "assert((function(d){if(d[0][0] == 'dog' && d[0][1] == 3 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"dog\", 3]].');", + "assert((function(d){if(d[0] === 'John' && d[1] === 23 && typeof(removedFromMyArray) === 'object'){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should contain [\"John\", 23].');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1614,9 +1640,6 @@ "

Instructions

", "Add [\"Paul\",35] to the beginning of the myArray variable using unshift()." ], - "tests": [ - "assert((function(d){if(typeof(d[0]) === \"object\" && d[0][0].toLowerCase() == 'paul' && d[0][1] == 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), 'message: myArray should now have [[\"Paul\", 35], [\"dog\", 3]]).');" - ], "challengeSeed": [ "// Example", "var ourArray = [\"Stimpson\", \"J\", \"cat\"];", @@ -1638,6 +1661,9 @@ "solutions": [ "var myArray = [[\"John\", 23], [\"dog\", 3]];\nmyArray.shift();\nmyArray.unshift([\"Paul\", 35]);" ], + "tests": [ + "assert((function(d){if(typeof(d[0]) === \"object\" && d[0][0].toLowerCase() == 'paul' && d[0][1] == 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), 'message: myArray should now have [[\"Paul\", 35], [\"dog\", 3]]).');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1651,12 +1677,6 @@ "There should be at least 5 sub-arrays in the list." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(isArray, 'message: myList should be an array');", - "assert(hasString, 'message: The first elements in each of your sub-arrays must all be strings');", - "assert(hasNumber, 'message: The second elements in each of your sub-arrays must all be numbers');", - "assert(count > 4, 'message: You must have at least 5 items in your list');" - ], "challengeSeed": [ "var myList = [];", "", @@ -1689,6 +1709,12 @@ "solutions": [ "var myList = [\n [\"Candy\", 10],\n [\"Potatoes\", 12],\n [\"Eggs\", 12],\n [\"Catfood\", 1],\n [\"Toads\", 9]\n];" ], + "tests": [ + "assert(isArray, 'message: myList should be an array');", + "assert(hasString, 'message: The first elements in each of your sub-arrays must all be strings');", + "assert(hasNumber, 'message: The second elements in each of your sub-arrays must all be numbers');", + "assert(count > 4, 'message: You must have at least 5 items in your list');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -1710,11 +1736,6 @@ "

Instructions

", "
  1. Create a function called myFunction which prints \"Hi World\" to the dev console.
  2. Call the function.
" ], - "tests": [ - "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", - "assert(\"Hi World\" === logOutput, 'message: myFunction should output \"Hi World\" to the dev console');", - "assert(/^\\s*myFunction\\(\\)\\s*;/m.test(code), 'message: Call myFunction after you define it');" - ], "challengeSeed": [ "// Example", "function ourFunction() {", @@ -1753,6 +1774,11 @@ "solutions": [ "function myFunction() {\n console.log(\"Hi World\");\n}\nmyFunction();" ], + "tests": [ + "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", + "assert(\"Hi World\" === logOutput, 'message: myFunction should output \"Hi World\" to the dev console');", + "assert(/^\\s*myFunction\\(\\)\\s*;/m.test(code), 'message: Call myFunction after you define it');" + ], "type": "waypoint", "challengeType": "1" }, @@ -1770,12 +1796,6 @@ "
  1. Create a function called myFunction that accepts two arguments and outputs their sum to the dev console.
  2. Call the function.
" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", - "capture(); myFunction(1,2); uncapture(); assert(logOutput == 3, 'message: myFunction(1,2) should output 3');", - "capture(); myFunction(7,9); uncapture(); assert(logOutput == 16, 'message: myFunction(7,9) should output 16');", - "assert(/^\\s*myFunction\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\)\\s*;/m.test(code), 'message: Call myFunction after you define it');" - ], "head": [ "var logOutput = \"\";", "var oldLog = console.log;", @@ -1813,7 +1833,13 @@ "}" ], "solutions": [ - "" + "function myFunction(a, b) {\n console.log(a + b);\n}\nmyFunction(10, 5);" + ], + "tests": [ + "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", + "capture(); myFunction(1,2); uncapture(); assert(logOutput == 3, 'message: myFunction(1,2) should output 3');", + "capture(); myFunction(7,9); uncapture(); assert(logOutput == 16, 'message: myFunction(7,9) should output 16');", + "assert(/^\\s*myFunction\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\)\\s*;/m.test(code), 'message: Call myFunction after you define it');" ], "type": "waypoint", "challengeType": "1", @@ -1834,13 +1860,6 @@ "Inside function fun1, assign 5 to oopsGlobal without using the var keyword." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof myGlobal != \"undefined\", 'message: myGlobal should be defined');", - "assert(myGlobal === 10, 'message: myGlobal should have a value of 10');", - "assert(/var\\s+myGlobal/.test(code), 'message: myGlobal should be declared using the var keyword');", - "assert(typeof oopsGlobal != \"undefined\" && oopsGlobal === 5, 'message: oopsGlobal should have a value of 5');", - "assert(!/var\\s+oopsGlobal/.test(code), 'message: Do not decalre oopsGlobal using the var keyword');" - ], "head": [ "var logOutput = \"\";", "var oldLog = console.log;", @@ -1854,7 +1873,7 @@ "function uncapture() {", " console.log = oldLog;", "}", - "", + "var oopsGlobal;", "capture();" ], "challengeSeed": [ @@ -1885,7 +1904,14 @@ "(function() { return logOutput || \"console.log never called\"; })();" ], "solutions": [ - "" + "// Declare your variable here\nvar myGlobal = 10;\n\nfunction fun1() {\n // Assign 5 to oopsGlobal Here\n oopsGlobal = 5;\n}\n\n// Only change code above this line\nfunction fun2() {\n var output = \"\";\n if(typeof myGlobal != \"undefined\") {\n output += \"myGlobal: \" + myGlobal;\n }\n if(typeof oopsGlobal != \"undefined\") {\n output += \" oopsGlobal: \" + oopsGlobal;\n }\n console.log(output);\n}" + ], + "tests": [ + "assert(typeof myGlobal != \"undefined\", 'message: myGlobal should be defined');", + "assert(myGlobal === 10, 'message: myGlobal should have a value of 10');", + "assert(/var\\s+myGlobal/.test(code), 'message: myGlobal should be declared using the var keyword');", + "assert(typeof oopsGlobal != \"undefined\" && oopsGlobal === 5, 'message: oopsGlobal should have a value of 5');", + "assert(!/var\\s+oopsGlobal/.test(code), 'message: Do not decalre oopsGlobal using the var keyword');" ], "type": "waypoint", "challengeType": "1", @@ -1907,9 +1933,6 @@ "Declare a local variable myVar inside myFunction" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(code.match(/console\\.log/gi).length === 1, 'message: Remove the second console log');" - ], "challengeSeed": [ "function myFunction() {", " ", @@ -1930,6 +1953,9 @@ "solutions": [ "function myFunction() {\n var myVar;\n console.log(myVar);\n}\nmyFunction();" ], + "tests": [ + "assert(code.match(/console\\.log/gi).length === 1, 'message: Remove the second console log');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -1950,11 +1976,6 @@ "Add a local variable to myFunction to override the value of outerWear with \"sweater\"." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(outerWear === \"T-Shirt\", 'message: Do not change the value of the global outerWear');", - "assert(myFunction() === \"sweater\", 'message: myFunction should return \"sweater\"');", - "assert(/return outerWear/.test(code), 'message: Do not change the return statement');" - ], "challengeSeed": [ "// Setup", "var outerWear = \"T-Shirt\";", @@ -1973,6 +1994,11 @@ "solutions": [ "var outerWear = \"T-Shirt\";\nfunction myFunction() {\n var outerWear = \"sweater\";\n return outerWear;\n}" ], + "tests": [ + "assert(outerWear === \"T-Shirt\", 'message: Do not change the value of the global outerWear');", + "assert(myFunction() === \"sweater\", 'message: myFunction should return \"sweater\"');", + "assert(/return outerWear/.test(code), 'message: Do not change the return statement');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -1993,12 +2019,6 @@ "Create a function timesFive that accepts one argument, multiplies it by 5, and returns the new value." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof timesFive === 'function', 'message: timesFive should be a function');", - "assert(timesFive(5) === 25, 'message: timesFive(5) should return 25');", - "assert(timesFive(2) === 10, 'message: timesFive(2) should return 10');", - "assert(timesFive(0) === 0, 'message: timesFive(0) should return 0');" - ], "challengeSeed": [ "// Example", "function minusSeven(num) {", @@ -2015,6 +2035,12 @@ "solutions": [ "function timesFive(num) {\n return num * 5;\n}" ], + "tests": [ + "assert(typeof timesFive === 'function', 'message: timesFive should be a function');", + "assert(timesFive(5) === 25, 'message: timesFive(5) should return 25');", + "assert(timesFive(2) === 10, 'message: timesFive(2) should return 10');", + "assert(timesFive(0) === 0, 'message: timesFive(0) should return 0');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2035,10 +2061,6 @@ "Call the process function with an argument of 7 and assign its return value to the variable processed." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(processed === 2, 'message: processed should have a value of 2');", - "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(code), 'message: You should assign process to processed');" - ], "challengeSeed": [ "// Setup", "var processed = 0;", @@ -2057,6 +2079,10 @@ "solutions": [ "var processed = 0;\n\nfunction process(num) {\n return (num + 3) / 5;\n}\n\nprocessed = process(7);" ], + "tests": [ + "assert(processed === 2, 'message: processed should have a value of 2');", + "assert(/processed\\s*=\\s*process\\(\\s*7\\s*\\)\\s*;/.test(code), 'message: You should assign process to processed');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2073,11 +2099,6 @@ "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove and return the item at the front of the queue." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(queue([],1) === 1, 'message: queue([], 1) should return 1');", - "assert(queue([2],1) === 2, 'message: queue([2], 1) should return 2');", - "queue(myArr, 10); assert(myArr[4] === 10, 'message: After queue(myArr, 10), myArr[4] should be 10');" - ], "head": [ "var logOutput = [];", "var oldLog = console.log;", @@ -2117,6 +2138,11 @@ "solutions": [ "var myArr = [ 1,2,3,4,5];\n\nfunction queue(myArr, item) {\n myArr.push(item);\n return myArr.shift();\n}" ], + "tests": [ + "assert(queue([],1) === 1, 'message: queue([], 1) should return 1');", + "assert(queue([2],1) === 2, 'message: queue([2], 1) should return 2');", + "queue(myArr, 10); assert(myArr[4] === 10, 'message: After queue(myArr, 10), myArr[4] should be 10');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -2137,14 +2163,6 @@ "

Instructions

", "Create an if statement inside the function to return \"Yes\" if testMe is greater than 5. Return \"No\" if it is less than or equal to 5." ], - "tests": [ - "assert(typeof myFunction === \"function\", 'message: myFunction should be a function');", - "assert(typeof myFunction(4) === \"string\", 'message: myFunction(4) should return a string');", - "assert(typeof myFunction(6) === \"string\", 'message: myFunction(6) should return a string');", - "assert(myFunction(4) === \"No\", 'message: myFunction(4) should \"No\"');", - "assert(myFunction(5) === \"No\", 'message: myFunction(5) should \"No\"');", - "assert(myFunction(6) === \"Yes\", 'message: myFunction(6) should \"Yes\"');" - ], "challengeSeed": [ "// Example", "function ourFunction(testMe) {", @@ -2171,6 +2189,14 @@ "solutions": [ "function myFunction(testMe) {\n if (testMe > 5) {\n return 'Yes';\n }\n return 'No';\n}" ], + "tests": [ + "assert(typeof myFunction === \"function\", 'message: myFunction should be a function');", + "assert(typeof myFunction(4) === \"string\", 'message: myFunction(4) should return a string');", + "assert(typeof myFunction(6) === \"string\", 'message: myFunction(6) should return a string');", + "assert(myFunction(4) === \"No\", 'message: myFunction(4) should \"No\"');", + "assert(myFunction(5) === \"No\", 'message: myFunction(5) should \"No\"');", + "assert(myFunction(6) === \"Yes\", 'message: myFunction(6) should \"Yes\"');" + ], "type": "waypoint", "challengeType": "1" }, @@ -2188,12 +2214,6 @@ "Add the equality operator to the indicated line so that the function will return \"Equal\" when val is equivalent to 12" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", - "assert(myTest(12) === \"Equal\", 'message: myTest(12) should return \"Equal\"');", - "assert(myTest(\"12\") === \"Equal\", 'message: myTest(\"12\") should return \"Equal\"');", - "assert(code.match(/val\\s*==\\s*\\d+/g).length > 0, 'message: You should use the == operator');" - ], "challengeSeed": [ "// Setup", "function myTest(val) {", @@ -2209,6 +2229,12 @@ "solutions": [ "function myTest(val) {\n if (val == 12) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}" ], + "tests": [ + "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", + "assert(myTest(12) === \"Equal\", 'message: myTest(12) should return \"Equal\"');", + "assert(myTest(\"12\") === \"Equal\", 'message: myTest(\"12\") should return \"Equal\"');", + "assert(code.match(/val\\s*==\\s*\\d+/g).length > 0, 'message: You should use the == operator');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2229,12 +2255,6 @@ "Use strict equality operator in if statement so the function will return \"Equal\" when val is strictly equal to 7" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", - "assert(myTest(7) === \"Equal\", 'message: myTest(7) should return \"Equal\"');", - "assert(myTest(\"7\") === \"Not Equal\", 'message: myTest(\"7\") should return \"Not Equal\"');", - "assert(code.match(/val\\s*===\\s*\\d+/g).length > 0, 'message: You should use the === operator');" - ], "challengeSeed": [ "// Setup", "function myTest(val) {", @@ -2250,6 +2270,12 @@ "solutions": [ "function myTest(val) {\n if (val === 7) {\n return \"Equal\";\n }\n return \"Not Equal\";\n}" ], + "tests": [ + "assert(myTest(10) === \"Not Equal\", 'message: myTest(10) should return \"Not Equal\"');", + "assert(myTest(7) === \"Equal\", 'message: myTest(7) should return \"Equal\"');", + "assert(myTest(\"7\") === \"Not Equal\", 'message: myTest(\"7\") should return \"Not Equal\"');", + "assert(code.match(/val\\s*===\\s*\\d+/g).length > 0, 'message: You should use the === operator');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2269,14 +2295,6 @@ "Add the inequality operator != in the if statement so that the function will return \"Not Equal\" when val is not equivalent to 99" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(99) === \"Equal\", 'message: myTest(99) should return \"Equal\"');", - "assert(myTest(\"99\") === \"Equal\", 'message: myTest(\"99\") should return \"Equal\"');", - "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", - "assert(myTest(\"12\") === \"Not Equal\", 'message: myTest(\"12\") should return \"Not Equal\"');", - "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", - "assert(code.match(/val\\s*!=\\s*\\d+/g).length > 0, 'message: You should use the != operator');" - ], "challengeSeed": [ "// Setup", "function myTest(val) {", @@ -2292,6 +2310,14 @@ "solutions": [ "function myTest(val) {\n if (val != 99) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}" ], + "tests": [ + "assert(myTest(99) === \"Equal\", 'message: myTest(99) should return \"Equal\"');", + "assert(myTest(\"99\") === \"Equal\", 'message: myTest(\"99\") should return \"Equal\"');", + "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", + "assert(myTest(\"12\") === \"Not Equal\", 'message: myTest(\"12\") should return \"Not Equal\"');", + "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", + "assert(code.match(/val\\s*!=\\s*\\d+/g).length > 0, 'message: You should use the != operator');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2311,13 +2337,6 @@ "Add the strict inequality operator to the if statement so the function will return \"Not Equal\" when val is not strictly equal to 17" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(17) === \"Equal\", 'message: myTest(17) should return \"Equal\"');", - "assert(myTest(\"17\") === \"Not Equal\", 'message: myTest(\"17\") should return \"Not Equal\"');", - "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", - "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", - "assert(code.match(/val\\s*!==\\s*\\d+/g).length > 0, 'message: You should use the !== operator');" - ], "challengeSeed": [ "// Setup", "function myTest(val) {", @@ -2338,6 +2357,13 @@ "solutions": [ "function myTest(val) {\n if (val !== 17) {\n return \"Not Equal\";\n }\n return \"Equal\";\n}" ], + "tests": [ + "assert(myTest(17) === \"Equal\", 'message: myTest(17) should return \"Equal\"');", + "assert(myTest(\"17\") === \"Not Equal\", 'message: myTest(\"17\") should return \"Not Equal\"');", + "assert(myTest(12) === \"Not Equal\", 'message: myTest(12) should return \"Not Equal\"');", + "assert(myTest(\"bob\") === \"Not Equal\", 'message: myTest(\"bob\") should return \"Not Equal\"');", + "assert(code.match(/val\\s*!==\\s*\\d+/g).length > 0, 'message: You should use the !== operator');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2357,16 +2383,6 @@ "Add the greater than operator to the indicated lines so that the return statements make sense." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(0) === \"10 or Under\", 'message: myTest(0) should return \"10 or Under\"');", - "assert(myTest(10) === \"10 or Under\", 'message: myTest(10) should return \"10 or Under\"');", - "assert(myTest(11) === \"Over 10\", 'message: myTest(11) should return \"Over 10\"');", - "assert(myTest(99) === \"Over 10\", 'message: myTest(99) should return \"Over 10\"');", - "assert(myTest(100) === \"Over 10\", 'message: myTest(100) should return \"Over 10\"');", - "assert(myTest(101) === \"Over 100\", 'message: myTest(101) should return \"Over 100\"');", - "assert(myTest(150) === \"Over 100\", 'message: myTest(150) should return \"Over 100\"');", - "assert(code.match(/val\\s*>\\s*\\d+/g).length > 1, 'message: You should use the > operator at least twice');" - ], "challengeSeed": [ "function myTest(val) {", " if (val) { // Change this line", @@ -2386,6 +2402,16 @@ "solutions": [ "function myTest(val) {\n if (val > 100) { // Change this line\n return \"Over 100\";\n }\n if (val > 10) { // Change this line\n return \"Over 10\";\n }\n return \"10 or Under\";\n}" ], + "tests": [ + "assert(myTest(0) === \"10 or Under\", 'message: myTest(0) should return \"10 or Under\"');", + "assert(myTest(10) === \"10 or Under\", 'message: myTest(10) should return \"10 or Under\"');", + "assert(myTest(11) === \"Over 10\", 'message: myTest(11) should return \"Over 10\"');", + "assert(myTest(99) === \"Over 10\", 'message: myTest(99) should return \"Over 10\"');", + "assert(myTest(100) === \"Over 10\", 'message: myTest(100) should return \"Over 10\"');", + "assert(myTest(101) === \"Over 100\", 'message: myTest(101) should return \"Over 100\"');", + "assert(myTest(150) === \"Over 100\", 'message: myTest(150) should return \"Over 100\"');", + "assert(code.match(/val\\s*>\\s*\\d+/g).length > 1, 'message: You should use the > operator at least twice');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2405,16 +2431,6 @@ "Add the greater than equal to operator to the indicated lines so that the return statements make sense." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(0) === \"9 or Under\", 'message: myTest(0) should return \"9 or Under\"');", - "assert(myTest(9) === \"9 or Under\", 'message: myTest(9) should return \"9 or Under\"');", - "assert(myTest(10) === \"10 or Over\", 'message: myTest(10) should return \"10 or Over\"');", - "assert(myTest(11) === \"10 or Over\", 'message: myTest(10) should return \"10 or Over\"');", - "assert(myTest(19) === \"10 or Over\", 'message: myTest(19) should return \"10 or Over\"');", - "assert(myTest(20) === \"20 or Over\", 'message: myTest(100) should return \"20 or Over\"');", - "assert(myTest(21) === \"20 or Over\", 'message: myTest(101) should return \"20 or Over\"');", - "assert(code.match(/val\\s*>=\\s*\\d+/g).length > 1, 'message: You should use the >= operator at least twice');" - ], "challengeSeed": [ "function myTest(val) {", " if (val) { // Change this line", @@ -2434,6 +2450,16 @@ "solutions": [ "function myTest(val) {\n if (val >= 20) { // Change this line\n return \"20 or Over\";\n }\n \n if (val >= 10) { // Change this line\n return \"10 or Over\";\n }\n\n return \"9 or Under\";\n}" ], + "tests": [ + "assert(myTest(0) === \"9 or Under\", 'message: myTest(0) should return \"9 or Under\"');", + "assert(myTest(9) === \"9 or Under\", 'message: myTest(9) should return \"9 or Under\"');", + "assert(myTest(10) === \"10 or Over\", 'message: myTest(10) should return \"10 or Over\"');", + "assert(myTest(11) === \"10 or Over\", 'message: myTest(10) should return \"10 or Over\"');", + "assert(myTest(19) === \"10 or Over\", 'message: myTest(19) should return \"10 or Over\"');", + "assert(myTest(20) === \"20 or Over\", 'message: myTest(100) should return \"20 or Over\"');", + "assert(myTest(21) === \"20 or Over\", 'message: myTest(101) should return \"20 or Over\"');", + "assert(code.match(/val\\s*>=\\s*\\d+/g).length > 1, 'message: You should use the >= operator at least twice');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2453,15 +2479,6 @@ "Add the less than operator to the indicated lines so that the return statements make sense." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(0) === \"Under 25\", 'message: myTest(0) should return \"Under 25\"');", - "assert(myTest(24) === \"Under 25\", 'message: myTest(24) should return \"Under 25\"');", - "assert(myTest(25) === \"Under 55\", 'message: myTest(25) should return \"Under 55\"');", - "assert(myTest(54) === \"Under 55\", 'message: myTest(54) should return \"Under 55\"');", - "assert(myTest(55) === \"55 or Over\", 'message: myTest(55) should return \"55 or Over\"');", - "assert(myTest(99) === \"55 or Over\", 'message: myTest(99) should return \"55 or Over\"');", - "assert(code.match(/val\\s*<\\s*\\d+/g).length > 1, 'message: You should use the < operator at least twice');" - ], "challengeSeed": [ "function myTest(val) {", " if (val) { // Change this line", @@ -2481,6 +2498,15 @@ "solutions": [ "function myTest(val) {\n if (val < 25) { // Change this line\n return \"Under 25\";\n }\n \n if (val < 55) { // Change this line\n return \"Under 55\";\n }\n\n return \"55 or Over\";\n}" ], + "tests": [ + "assert(myTest(0) === \"Under 25\", 'message: myTest(0) should return \"Under 25\"');", + "assert(myTest(24) === \"Under 25\", 'message: myTest(24) should return \"Under 25\"');", + "assert(myTest(25) === \"Under 55\", 'message: myTest(25) should return \"Under 55\"');", + "assert(myTest(54) === \"Under 55\", 'message: myTest(54) should return \"Under 55\"');", + "assert(myTest(55) === \"55 or Over\", 'message: myTest(55) should return \"55 or Over\"');", + "assert(myTest(99) === \"55 or Over\", 'message: myTest(99) should return \"55 or Over\"');", + "assert(code.match(/val\\s*<\\s*\\d+/g).length > 1, 'message: You should use the < operator at least twice');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2500,16 +2526,6 @@ "Add the less than equal to operator to the indicated lines so that the return statements make sense." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(0) === \"Smaller Than or Equal to 12\", 'message: myTest(0) should return \"Smaller Than or Equal to 12\"');", - "assert(myTest(11) === \"Smaller Than or Equal to 12\", 'message: myTest(11) should return \"Smaller Than or Equal to 12\"');", - "assert(myTest(12) === \"Smaller Than or Equal to 12\", 'message: myTest(12) should return \"Smaller Than or Equal to 12\"');", - "assert(myTest(23) === \"Smaller Than or Equal to 24\", 'message: myTest(23) should return \"Smaller Than or Equal to 24\"');", - "assert(myTest(24) === \"Smaller Than or Equal to 24\", 'message: myTest(24) should return \"Smaller Than or Equal to 24\"');", - "assert(myTest(25) === \"25 or More\", 'message: myTest(25) should return \"25 or More\"');", - "assert(myTest(55) === \"25 or More\", 'message: myTest(55) should return \"25 or More\"');", - "assert(code.match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <= operator at least twice');" - ], "challengeSeed": [ "function myTest(val) {", " if (val) { // Change this line", @@ -2530,6 +2546,16 @@ "solutions": [ "function myTest(val) {\n if (val <= 12) { // Change this line\n return \"Smaller Than or Equal to 12\";\n }\n \n if (val <= 24) { // Change this line\n return \"Smaller Than or Equal to 24\";\n }\n\n return \"25 or More\";\n}" ], + "tests": [ + "assert(myTest(0) === \"Smaller Than or Equal to 12\", 'message: myTest(0) should return \"Smaller Than or Equal to 12\"');", + "assert(myTest(11) === \"Smaller Than or Equal to 12\", 'message: myTest(11) should return \"Smaller Than or Equal to 12\"');", + "assert(myTest(12) === \"Smaller Than or Equal to 12\", 'message: myTest(12) should return \"Smaller Than or Equal to 12\"');", + "assert(myTest(23) === \"Smaller Than or Equal to 24\", 'message: myTest(23) should return \"Smaller Than or Equal to 24\"');", + "assert(myTest(24) === \"Smaller Than or Equal to 24\", 'message: myTest(24) should return \"Smaller Than or Equal to 24\"');", + "assert(myTest(25) === \"25 or More\", 'message: myTest(25) should return \"25 or More\"');", + "assert(myTest(55) === \"25 or More\", 'message: myTest(55) should return \"25 or More\"');", + "assert(code.match(/val\\s*<=\\s*\\d+/g).length > 1, 'message: You should use the <= operator at least twice');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2551,18 +2577,6 @@ "Combine the two if statements into one statement which will return \"Yes\" if val is less than or equal to 50 and greater than or equal to 25. Otherwise, will return \"No\"." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(code.match(/&&/g).length === 1, 'message: You should use the && operator once');", - "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", - "assert(myTest(0) === \"No\", 'message: myTest(0) should return \"No\"');", - "assert(myTest(24) === \"No\", 'message: myTest(24) should return \"No\"');", - "assert(myTest(25) === \"Yes\", 'message: myTest(25) should return \"Yes\"');", - "assert(myTest(49) === \"Yes\", 'message: myTest(30) should return \"Yes\"');", - "assert(myTest(50) === \"Yes\", 'message: myTest(50) should return \"Yes\"');", - "assert(myTest(51) === \"No\", 'message: myTest(51) should return \"No\"');", - "assert(myTest(75) === \"No\", 'message: myTest(75) should return \"No\"');", - "assert(myTest(51) === \"No\", 'message: myTest(51) should return \"No\"');" - ], "challengeSeed": [ "function myTest(val) {", " // Only change code below this line", @@ -2583,6 +2597,18 @@ "solutions": [ "function myTest(val) {\n if (val >= 25 && val <= 50) {\n return \"Yes\";\n }\n return \"No\";\n}" ], + "tests": [ + "assert(code.match(/&&/g).length === 1, 'message: You should use the && operator once');", + "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(myTest(0) === \"No\", 'message: myTest(0) should return \"No\"');", + "assert(myTest(24) === \"No\", 'message: myTest(24) should return \"No\"');", + "assert(myTest(25) === \"Yes\", 'message: myTest(25) should return \"Yes\"');", + "assert(myTest(49) === \"Yes\", 'message: myTest(30) should return \"Yes\"');", + "assert(myTest(50) === \"Yes\", 'message: myTest(50) should return \"Yes\"');", + "assert(myTest(51) === \"No\", 'message: myTest(51) should return \"No\"');", + "assert(myTest(75) === \"No\", 'message: myTest(75) should return \"No\"');", + "assert(myTest(51) === \"No\", 'message: myTest(51) should return \"No\"');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2604,18 +2630,6 @@ "Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(code.match(/\\|\\|/g).length === 1, 'message: You should use the || operator once');", - "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", - "assert(myTest(0) === \"Outside\", 'message: myTest(0) should return \"Outside\"');", - "assert(myTest(9) === \"Outside\", 'message: myTest(9) should return \"Outside\"');", - "assert(myTest(10) === \"Inside\", 'message: myTest(10) should return \"Inside\"');", - "assert(myTest(15) === \"Inside\", 'message: myTest(15) should return \"Inside\"');", - "assert(myTest(19) === \"Inside\", 'message: myTest(19) should return \"Inside\"');", - "assert(myTest(20) === \"Inside\", 'message: myTest(20) should return \"Inside\"');", - "assert(myTest(21) === \"Outside\", 'message: myTest(21) should return \"Outside\"');", - "assert(myTest(25) === \"Outside\", 'message: myTest(25) should return \"Outside\"');" - ], "challengeSeed": [ "function myTest(val) {", " // Only change code below this line", @@ -2638,6 +2652,18 @@ "solutions": [ "function myTest(val) {\n if (val < 10 || val > 20) {\n return \"Outside\";\n }\n return \"Inside\";\n}" ], + "tests": [ + "assert(code.match(/\\|\\|/g).length === 1, 'message: You should use the || operator once');", + "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(myTest(0) === \"Outside\", 'message: myTest(0) should return \"Outside\"');", + "assert(myTest(9) === \"Outside\", 'message: myTest(9) should return \"Outside\"');", + "assert(myTest(10) === \"Inside\", 'message: myTest(10) should return \"Inside\"');", + "assert(myTest(15) === \"Inside\", 'message: myTest(15) should return \"Inside\"');", + "assert(myTest(19) === \"Inside\", 'message: myTest(19) should return \"Inside\"');", + "assert(myTest(20) === \"Inside\", 'message: myTest(20) should return \"Inside\"');", + "assert(myTest(21) === \"Outside\", 'message: myTest(21) should return \"Outside\"');", + "assert(myTest(25) === \"Outside\", 'message: myTest(25) should return \"Outside\"');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2656,15 +2682,6 @@ "Combine the if statements into a single statement." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", - "assert(/else/g.test(code), 'message: You should use an else statement');", - "assert(myTest(4) === \"5 or Smaller\", 'message: myTest(4) should return \"5 or Smaller\"');", - "assert(myTest(5) === \"5 or Smaller\", 'message: myTest(5) should return \"5 or Smaller\"');", - "assert(myTest(6) === \"Bigger than 5\", 'message: myTest(6) should return \"Bigger than 5\"');", - "assert(myTest(10) === \"Bigger than 5\", 'message: myTest(10) should return \"Bigger than 5\"');", - "assert(/var result = \"\";/.test(code) && /return result;/.test(code), 'message: Do not change the code above or below the lines.');" - ], "challengeSeed": [ "function myTest(val) {", " var result = \"\";", @@ -2689,6 +2706,15 @@ "solutions": [ "function myTest(val) {\n var result = \"\";\n if(val > 5) {\n result = \"Bigger than 5\";\n } else {\n result = \"5 or Smaller\";\n }\n return result;\n}" ], + "tests": [ + "assert(code.match(/if/g).length === 1, 'message: You should only have one if statement');", + "assert(/else/g.test(code), 'message: You should use an else statement');", + "assert(myTest(4) === \"5 or Smaller\", 'message: myTest(4) should return \"5 or Smaller\"');", + "assert(myTest(5) === \"5 or Smaller\", 'message: myTest(5) should return \"5 or Smaller\"');", + "assert(myTest(6) === \"Bigger than 5\", 'message: myTest(6) should return \"Bigger than 5\"');", + "assert(myTest(10) === \"Bigger than 5\", 'message: myTest(10) should return \"Bigger than 5\"');", + "assert(/var result = \"\";/.test(code) && /return result;/.test(code), 'message: Do not change the code above or below the lines.');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2707,15 +2733,6 @@ "Convert the logic to use else if statements." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(code.match(/else/g).length > 1, 'message: You should have at least two else statements');", - "assert(code.match(/if/g).length > 1, 'message: You should have at least two if statements');", - "assert(myTest(0) === \"Smaller than 5\", 'message: myTest(4) should return \"Smaller than 5\"');", - "assert(myTest(5) === \"Between 5 and 10\", 'message: myTest(5) should return \"Smaller than 5\"');", - "assert(myTest(7) === \"Between 5 and 10\", 'message: myTest(7) should return \"Between 5 and 10\"');", - "assert(myTest(10) === \"Between 5 and 10\", 'message: myTest(10) should return \"Between 5 and 10\"');", - "assert(myTest(12) === \"10 or Bigger\", 'message: myTest(12) should return \"10 or Bigger\"');" - ], "challengeSeed": [ "function myTest(val) {", " if(val > 10) {", @@ -2736,6 +2753,15 @@ "solutions": [ "function myTest(val) {\n if(val > 10) {\n return \"10 or Bigger\";\n } else if(val < 5) {\n return \"Smaller than 5\";\n } else {\n return \"Between 5 and 10\";\n }\n}" ], + "tests": [ + "assert(code.match(/else/g).length > 1, 'message: You should have at least two else statements');", + "assert(code.match(/if/g).length > 1, 'message: You should have at least two if statements');", + "assert(myTest(0) === \"Smaller than 5\", 'message: myTest(4) should return \"Smaller than 5\"');", + "assert(myTest(5) === \"Between 5 and 10\", 'message: myTest(5) should return \"Smaller than 5\"');", + "assert(myTest(7) === \"Between 5 and 10\", 'message: myTest(7) should return \"Between 5 and 10\"');", + "assert(myTest(10) === \"Between 5 and 10\", 'message: myTest(10) should return \"Between 5 and 10\"');", + "assert(myTest(12) === \"10 or Bigger\", 'message: myTest(12) should return \"10 or Bigger\"');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2755,21 +2781,6 @@ "num < 5 - return \"Tiny\"
num < 10 - return \"Small\"
num < 15 - return \"Medium\"
num < 20 - return \"Large\"
num >= 20 - return \"Huge\"" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(code.match(/else/g).length > 3, 'message: You should have at least four else statements');", - "assert(code.match(/if/g).length > 3, 'message: You should have at least four if statements');", - "assert(code.match(/return/g).length === 5, 'message: You should have five return statements');", - "assert(myTest(0) === \"Tiny\", 'message: myTest(0) should return \"Tiny\"');", - "assert(myTest(4) === \"Tiny\", 'message: myTest(4) should return \"Tiny\"');", - "assert(myTest(5) === \"Small\", 'message: myTest(5) should return \"Small\"');", - "assert(myTest(8) === \"Small\", 'message: myTest(8) should return \"Small\"');", - "assert(myTest(10) === \"Medium\", 'message: myTest(10) should return \"Medium\"');", - "assert(myTest(14) === \"Medium\", 'message: myTest(14) should return \"Medium\"');", - "assert(myTest(15) === \"Large\", 'message: myTest(15) should return \"Large\"');", - "assert(myTest(17) === \"Large\", 'message: myTest(17) should return \"Large\"');", - "assert(myTest(20) === \"Huge\", 'message: myTest(20) should return \"Huge\"');", - "assert(myTest(25) === \"Huge\", 'message: myTest(25) should return \"Huge\"');" - ], "challengeSeed": [ "function myTest(num) {", " // Only change code below this line", @@ -2785,6 +2796,21 @@ "solutions": [ "function myTest(num) {\n if (num < 5) {\n return \"Tiny\";\n } else if (num < 10) {\n return \"Small\";\n } else if (num < 15) {\n return \"Medium\";\n } else if (num < 20) {\n return \"Large\";\n } else {\n return \"Huge\";\n }\n}" ], + "tests": [ + "assert(code.match(/else/g).length > 3, 'message: You should have at least four else statements');", + "assert(code.match(/if/g).length > 3, 'message: You should have at least four if statements');", + "assert(code.match(/return/g).length === 5, 'message: You should have five return statements');", + "assert(myTest(0) === \"Tiny\", 'message: myTest(0) should return \"Tiny\"');", + "assert(myTest(4) === \"Tiny\", 'message: myTest(4) should return \"Tiny\"');", + "assert(myTest(5) === \"Small\", 'message: myTest(5) should return \"Small\"');", + "assert(myTest(8) === \"Small\", 'message: myTest(8) should return \"Small\"');", + "assert(myTest(10) === \"Medium\", 'message: myTest(10) should return \"Medium\"');", + "assert(myTest(14) === \"Medium\", 'message: myTest(14) should return \"Medium\"');", + "assert(myTest(15) === \"Large\", 'message: myTest(15) should return \"Large\"');", + "assert(myTest(17) === \"Large\", 'message: myTest(17) should return \"Large\"');", + "assert(myTest(20) === \"Huge\", 'message: myTest(20) should return \"Huge\"');", + "assert(myTest(25) === \"Huge\", 'message: myTest(25) should return \"Huge\"');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2803,19 +2829,6 @@ "par and strokes will always be numeric and positive." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", - "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", - "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(5, 2) should return \"Eagle\"');", - "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", - "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", - "assert(golfScore(1, 1) === \"Hole-in-one!\", 'message: golfScore(1, 1) should return \"Hole-in-one!\"');", - "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", - "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", - "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", - "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", - "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" - ], "challengeSeed": [ "function golfScore(par, strokes) {", " // Only change code below this line", @@ -2831,6 +2844,19 @@ "solutions": [ "function golfScore(par, strokes) {\n if (strokes === 1) {\n return \"Hole-in-one!\";\n }\n \n if (strokes <= par - 2) {\n return \"Eagle\";\n }\n \n if (strokes === par - 1) {\n return \"Birdie\";\n }\n \n if (strokes === par) {\n return \"Par\";\n }\n \n if (strokes === par + 1) {\n return \"Bogey\";\n }\n \n if(strokes === par + 2) {\n return \"Double Bogey\";\n }\n \n return \"Go Home!\";\n}" ], + "tests": [ + "assert(golfScore(4, 1) === \"Hole-in-one!\", 'message: golfScore(4, 1) should return \"Hole-in-one!\"');", + "assert(golfScore(4, 2) === \"Eagle\", 'message: golfScore(4, 2) should return \"Eagle\"');", + "assert(golfScore(5, 2) === \"Eagle\", 'message: golfScore(5, 2) should return \"Eagle\"');", + "assert(golfScore(4, 3) === \"Birdie\", 'message: golfScore(4, 3) should return \"Birdie\"');", + "assert(golfScore(4, 4) === \"Par\", 'message: golfScore(4, 4) should return \"Par\"');", + "assert(golfScore(1, 1) === \"Hole-in-one!\", 'message: golfScore(1, 1) should return \"Hole-in-one!\"');", + "assert(golfScore(5, 5) === \"Par\", 'message: golfScore(5, 5) should return \"Par\"');", + "assert(golfScore(4, 5) === \"Bogey\", 'message: golfScore(4, 5) should return \"Bogey\"');", + "assert(golfScore(4, 6) === \"Double Bogey\", 'message: golfScore(4, 6) should return \"Double Bogey\"');", + "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", + "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -2851,14 +2877,6 @@ "Write a switch statement which tests val and sets answer for the following conditions:
1 - \"alpha\"
2 - \"beta\"
3 - \"gamma\"
4 - \"delta\"" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(1) === \"alpha\", 'message: myTest(1) should have a value of \"alpha\"');", - "assert(myTest(2) === \"beta\", 'message: myTest(2) should have a value of \"beta\"');", - "assert(myTest(3) === \"gamma\", 'message: myTest(3) should have a value of \"gamma\"');", - "assert(myTest(4) === \"delta\", 'message: myTest(4) should have a value of \"delta\"');", - "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", - "assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break statements');" - ], "challengeSeed": [ "function myTest(val) {", " var answer = \"\";", @@ -2877,6 +2895,14 @@ "solutions": [ "function myTest(val) {\n var answer = \"\";\n\n switch (val) {\n case 1:\n answer = \"alpha\";\n break;\n case 2:\n answer = \"beta\";\n break;\n case 3:\n answer = \"gamma\";\n break;\n case 4:\n answer = \"delta\";\n }\n return answer; \n}" ], + "tests": [ + "assert(myTest(1) === \"alpha\", 'message: myTest(1) should have a value of \"alpha\"');", + "assert(myTest(2) === \"beta\", 'message: myTest(2) should have a value of \"beta\"');", + "assert(myTest(3) === \"gamma\", 'message: myTest(3) should have a value of \"gamma\"');", + "assert(myTest(4) === \"delta\", 'message: myTest(4) should have a value of \"delta\"');", + "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", + "assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break statements');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2896,15 +2922,6 @@ "Write a switch statement to set answer for the following conditions:
\"a\" - \"apple\"
\"b\" - \"bird\"
\"c\" - \"cat\"
default - \"stuff\"" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(\"a\") === \"apple\", 'message: myTest(\"a\") should have a value of \"apple\"');", - "assert(myTest(\"b\") === \"bird\", 'message: myTest(\"b\") should have a value of \"bird\"');", - "assert(myTest(\"c\") === \"cat\", 'message: myTest(\"c\") should have a value of \"cat\"');", - "assert(myTest(\"d\") === \"stuff\", 'message: myTest(\"d\") should have a value of \"stuff\"');", - "assert(myTest(4) === \"stuff\", 'message: myTest(4) should have a value of \"stuff\"');", - "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", - "assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break statements');" - ], "challengeSeed": [ "function myTest(val) {", " var answer = \"\";", @@ -2923,6 +2940,15 @@ "solutions": [ "function myTest(val) {\n var answer = \"\";\n\n switch(val) {\n case \"a\":\n answer = \"apple\";\n break;\n case \"b\":\n answer = \"bird\";\n break;\n case \"c\":\n answer = \"cat\";\n break;\n default:\n answer = \"stuff\";\n }\n return answer; \n}" ], + "tests": [ + "assert(myTest(\"a\") === \"apple\", 'message: myTest(\"a\") should have a value of \"apple\"');", + "assert(myTest(\"b\") === \"bird\", 'message: myTest(\"b\") should have a value of \"bird\"');", + "assert(myTest(\"c\") === \"cat\", 'message: myTest(\"c\") should have a value of \"cat\"');", + "assert(myTest(\"d\") === \"stuff\", 'message: myTest(\"d\") should have a value of \"stuff\"');", + "assert(myTest(4) === \"stuff\", 'message: myTest(4) should have a value of \"stuff\"');", + "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", + "assert(code.match(/break/g).length > 2, 'message: You should have at least 3 break statements');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2944,19 +2970,6 @@ "You will need to have a case statement for each number in the range." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(myTest(1) === \"Low\", 'message: myTest(1) should return \"Low\"');", - "assert(myTest(2) === \"Low\", 'message: myTest(2) should return \"Low\"');", - "assert(myTest(3) === \"Low\", 'message: myTest(3) should return \"Low\"');", - "assert(myTest(4) === \"Mid\", 'message: myTest(4) should return \"Mid\"');", - "assert(myTest(5) === \"Mid\", 'message: myTest(5) should return \"Mid\"');", - "assert(myTest(6) === \"Mid\", 'message: myTest(6) should return \"Mid\"');", - "assert(myTest(7) === \"High\", 'message: myTest(7) should return \"High\"');", - "assert(myTest(8) === \"High\", 'message: myTest(8) should return \"High\"');", - "assert(myTest(9) === \"High\", 'message: myTest(9) should return \"High\"');", - "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", - "assert(code.match(/case/g).length === 9, 'message: You should have nine case statements');" - ], "challengeSeed": [ "function myTest(val) {", " var answer = \"\";", @@ -2975,6 +2988,19 @@ "solutions": [ "function myTest(val) {\n var answer = \"\";\n \n switch (val) {\n case 1:\n case 2:\n case 3:\n answer = \"Low\";\n break;\n case 4:\n case 5:\n case 6:\n answer = \"Mid\";\n break;\n case 7:\n case 8:\n case 9:\n answer = \"High\";\n }\n \n return answer; \n}" ], + "tests": [ + "assert(myTest(1) === \"Low\", 'message: myTest(1) should return \"Low\"');", + "assert(myTest(2) === \"Low\", 'message: myTest(2) should return \"Low\"');", + "assert(myTest(3) === \"Low\", 'message: myTest(3) should return \"Low\"');", + "assert(myTest(4) === \"Mid\", 'message: myTest(4) should return \"Mid\"');", + "assert(myTest(5) === \"Mid\", 'message: myTest(5) should return \"Mid\"');", + "assert(myTest(6) === \"Mid\", 'message: myTest(6) should return \"Mid\"');", + "assert(myTest(7) === \"High\", 'message: myTest(7) should return \"High\"');", + "assert(myTest(8) === \"High\", 'message: myTest(8) should return \"High\"');", + "assert(myTest(9) === \"High\", 'message: myTest(9) should return \"High\"');", + "assert(!/else/g.test(code) || !/if/g.test(code), 'message: You should not use any if or else statements');", + "assert(code.match(/case/g).length === 9, 'message: You should have nine case statements');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -2995,18 +3021,6 @@ "Change the chained if/if else statements into a switch statement." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(!/else/g.test(code), 'message: You should not use any else statements');", - "assert(!/if/g.test(code), 'message: You should not use any if statements');", - "assert(code.match(/break/g).length === 4, 'message: You should have four break statements');", - "assert(myTest(\"bob\") === \"Marley\", 'message: myTest(\"bob\") should be \"Marley\"');", - "assert(myTest(42) === \"The Answer\", 'message: myTest(42) should be \"The Answer\"');", - "assert(myTest(1) === \"There is no #1\", 'message: myTest(1) should be \"There is no #1\"');", - "assert(myTest(99) === \"Missed me by this much!\", 'message: myTest(99) should be \"Missed me by this much!\"');", - "assert(myTest(7) === \"Ate Nine\", 'message: myTest(7) should be \"Ate Nine\"');", - "assert(myTest(\"John\") === \"\", 'message: myTest(\"John\") should be \"\" (empty string)');", - "assert(myTest(156) === \"\", 'message: myTest(156) should be \"\" (empty string)');" - ], "challengeSeed": [ "function myTest(val) {", " var answer = \"\";", @@ -3035,6 +3049,18 @@ "solutions": [ "function myTest(val) {\n var answer = \"\";\n\n switch (val) {\n case \"bob\":\n answer = \"Marley\";\n break;\n case 42:\n answer = \"The Answer\";\n break;\n case 1:\n answer = \"There is no #1\";\n break;\n case 99:\n answer = \"Missed me by this much!\";\n break;\n case 7:\n answer = \"Ate Nine\";\n }\n return answer; \n}" ], + "tests": [ + "assert(!/else/g.test(code), 'message: You should not use any else statements');", + "assert(!/if/g.test(code), 'message: You should not use any if statements');", + "assert(code.match(/break/g).length === 4, 'message: You should have four break statements');", + "assert(myTest(\"bob\") === \"Marley\", 'message: myTest(\"bob\") should be \"Marley\"');", + "assert(myTest(42) === \"The Answer\", 'message: myTest(42) should be \"The Answer\"');", + "assert(myTest(1) === \"There is no #1\", 'message: myTest(1) should be \"There is no #1\"');", + "assert(myTest(99) === \"Missed me by this much!\", 'message: myTest(99) should be \"Missed me by this much!\"');", + "assert(myTest(7) === \"Ate Nine\", 'message: myTest(7) should be \"Ate Nine\"');", + "assert(myTest(\"John\") === \"\", 'message: myTest(\"John\") should be \"\" (empty string)');", + "assert(myTest(156) === \"\", 'message: myTest(156) should be \"\" (empty string)');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3056,11 +3082,6 @@ "Fix the function isLess to remove the if/else statements." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(isLess(10,15) === true, 'message: isLess(10,15) should return true');", - "assert(isLess(15, 10) === false, 'message: isLess(15,10) should return true');", - "assert(!/if|else/g.test(code), 'message: You should not use any if or else statements');" - ], "challengeSeed": [ "function isLess(a, b) {", " // Fix this code", @@ -3080,6 +3101,11 @@ "solutions": [ "function isLess(a, b) {\n return a < b;\n}" ], + "tests": [ + "assert(isLess(10,15) === true, 'message: isLess(10,15) should return true');", + "assert(isLess(15, 10) === false, 'message: isLess(15,10) should return true');", + "assert(!/if|else/g.test(code), 'message: You should not use any if or else statements');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3100,14 +3126,6 @@ "Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof abTest(2,2) === 'number' , 'message: abTest(2,2) should return a number');", - "assert(abTest(2,2) === 8 , 'message: abTest(2,2) should return 8');", - "assert(abTest(-2,2) === undefined , 'message: abTest(-2,2) should return undefined');", - "assert(abTest(2,-2) === undefined , 'message: abTest(2,-2) should return undefined');", - "assert(abTest(2,8) === 18 , 'message: abTest(2,8) should return 18');", - "assert(abTest(3,3) === 12 , 'message: abTest(3,3) should return 12');" - ], "challengeSeed": [ "// Setup", "function abTest(a, b) {", @@ -3129,6 +3147,14 @@ "solutions": [ "function abTest(a, b) {\n if(a < 0 || b < 0) {\n return undefined;\n } \n return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));\n}" ], + "tests": [ + "assert(typeof abTest(2,2) === 'number' , 'message: abTest(2,2) should return a number');", + "assert(abTest(2,2) === 8 , 'message: abTest(2,2) should return 8');", + "assert(abTest(-2,2) === undefined , 'message: abTest(-2,2) should return undefined');", + "assert(abTest(2,-2) === undefined , 'message: abTest(2,-2) should return undefined');", + "assert(abTest(2,8) === 18 , 'message: abTest(2,8) should return 18');", + "assert(abTest(3,3) === 12 , 'message: abTest(3,3) should return 12');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3149,12 +3175,6 @@ "-3 Hold
5 Bet" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === \"5 Bet\") {return true;} return false; })(), 'message: Cards Sequence 2, 3, 4, 5, 6 should return \"5 Bet\"');", - "assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === \"0 Hold\") {return true;} return false; })(), 'message: Cards Sequence 7, 8, 9 should return \"0 Hold\"');", - "assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === \"-5 Hold\") {return true;} return false; })(), 'message: Cards Sequence 10, J, Q, K, A should return \"-5 Hold\"');", - "assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === \"-1 Hold\") {return true;} return false; })(), 'message: Cards Sequence 3, 2, A, 10, K should return \"-1 Hold\"');" - ], "challengeSeed": [ "var count = 0;", "", @@ -3173,6 +3193,12 @@ "solutions": [ "var count = 0;\nfunction cc(card) {\n switch(card) {\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n count++;\n break;\n case 10:\n case 'J':\n case 'Q':\n case 'K':\n case 'A':\n count--;\n }\n if(count > 0) {\n return count + \" Bet\";\n } else {\n return count + \" Hold\";\n }\n}" ], + "tests": [ + "assert((function(){ count = 0; cc(2);cc(3);cc(4);cc(5);var out = cc(6); if(out === \"5 Bet\") {return true;} return false; })(), 'message: Cards Sequence 2, 3, 4, 5, 6 should return \"5 Bet\"');", + "assert((function(){ count = 0; cc(7);cc(8);var out = cc(9); if(out === \"0 Hold\") {return true;} return false; })(), 'message: Cards Sequence 7, 8, 9 should return \"0 Hold\"');", + "assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === \"-5 Hold\") {return true;} return false; })(), 'message: Cards Sequence 10, J, Q, K, A should return \"-5 Hold\"');", + "assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === \"-1 Hold\") {return true;} return false; })(), 'message: Cards Sequence 3, 2, A, 10, K should return \"-1 Hold\"');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -3194,13 +3220,6 @@ "Make an object that represents a dog called myDog which contains the properties \"name\" (a string), \"legs\", \"tails\" and \"friends\".", "You can set these object properties to whatever values you want, as long \"name\" is a string, \"legs\" and \"tails\" are numbers, and \"friends\" is an array." ], - "tests": [ - "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'message: 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), 'message: 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), 'message: 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), 'message: myDog should contain the property friends and it should be an array.');", - "assert((function(z){return Object.keys(z).length === 4;})(myDog), 'message: myDog should only contain all the given properties.');" - ], "challengeSeed": [ "// Example", "var ourDog = {", @@ -3225,6 +3244,13 @@ "solutions": [ "var myDog = {\n \"name\": \"Camper\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"everything!\"] \n};" ], + "tests": [ + "assert((function(z){if(z.hasOwnProperty(\"name\") && z.name !== undefined && typeof(z.name) === \"string\"){return true;}else{return false;}})(myDog), 'message: 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), 'message: 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), 'message: 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), 'message: myDog should contain the property friends and it should be an array.');", + "assert((function(z){return Object.keys(z).length === 4;})(myDog), 'message: myDog should only contain all the given properties.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3240,13 +3266,6 @@ "Read the values of the properties hat and shirt of testObj using dot notation." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof hatValue === 'string' , 'message: hatValue should be a string');", - "assert(hatValue === 'ballcap' , 'message: The value of hatValue should be \"ballcap\"');", - "assert(typeof shirtValue === 'string' , 'message: shirtValue should be a string');", - "assert(shirtValue === 'jersey' , 'message: The value of shirtValue should be \"jersey\"');", - "assert(code.match(/testObj\\.\\w+/g).length > 1, 'message: You should use dot notation twice');" - ], "challengeSeed": [ "// Setup", "var testObj = {", @@ -3266,6 +3285,13 @@ "solutions": [ "var testObj = {\n \"hat\": \"ballcap\",\n \"shirt\": \"jersey\",\n \"shoes\": \"cleats\"\n};\n\nvar hatValue = testObj.hat; \nvar shirtValue = testObj.shirt;" ], + "tests": [ + "assert(typeof hatValue === 'string' , 'message: hatValue should be a string');", + "assert(hatValue === 'ballcap' , 'message: The value of hatValue should be \"ballcap\"');", + "assert(typeof shirtValue === 'string' , 'message: shirtValue should be a string');", + "assert(shirtValue === 'jersey' , 'message: The value of shirtValue should be \"jersey\"');", + "assert(code.match(/testObj\\.\\w+/g).length > 1, 'message: You should use dot notation twice');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3286,13 +3312,6 @@ "Read the values of the properties \"an entree\" and \"the drink\" of testObj using bracket notation." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof entreeValue === 'string' , 'message: entreeValue should be a string');", - "assert(entreeValue === 'hamburger' , 'message: The value of entreeValue should be \"hamburger\"');", - "assert(typeof drinkValue === 'string' , 'message: drinkValue should be a string');", - "assert(drinkValue === 'water' , 'message: The value of drinkValue should be \"water\"');", - "assert(code.match(/testObj\\[('|\")[^'\"]+\\1\\]/g).length > 1, 'message: You should use bracket notation twice');" - ], "challengeSeed": [ "// Setup", "var testObj = {", @@ -3312,6 +3331,13 @@ "solutions": [ "var testObj = {\n \"an entree\": \"hamburger\",\n \"my side\": \"veggies\",\n \"the drink\": \"water\"\n};\nvar entreeValue = testObj[\"an entree\"];\nvar drinkValue = testObj['the drink'];" ], + "tests": [ + "assert(typeof entreeValue === 'string' , 'message: entreeValue should be a string');", + "assert(entreeValue === 'hamburger' , 'message: The value of entreeValue should be \"hamburger\"');", + "assert(typeof drinkValue === 'string' , 'message: drinkValue should be a string');", + "assert(drinkValue === 'water' , 'message: The value of drinkValue should be \"water\"');", + "assert(code.match(/testObj\\[('|\")[^'\"]+\\1\\]/g).length > 1, 'message: You should use bracket notation twice');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3332,12 +3358,6 @@ "Use the playerNumber variable to lookup player 16 in testObj using bracket notation." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(typeof playerNumber === 'number', 'message: playerNumber should be a number');", - "assert(typeof player === 'string', 'message: The variable player should be a string');", - "assert(player === 'Montana', 'message: The value of player should be \"Montana\"');", - "assert(/testObj\\[\\s*playerNumber\\s*\\]/.test(code),'message: You should use bracket notation to access testObj');" - ], "challengeSeed": [ "// Setup", "var testObj = {", @@ -3357,6 +3377,12 @@ "solutions": [ "var testObj = {\n 12: \"Namath\",\n 16: \"Montana\",\n 19: \"Unitas\"\n};\nvar playerNumber = 16;\nvar player = testObj[playerNumber];" ], + "tests": [ + "assert(typeof playerNumber === 'number', 'message: playerNumber should be a number');", + "assert(typeof player === 'string', 'message: The variable player should be a string');", + "assert(player === 'Montana', 'message: The value of player should be \"Montana\"');", + "assert(/testObj\\[\\s*playerNumber\\s*\\]/.test(code),'message: You should use bracket notation to access testObj');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3379,10 +3405,6 @@ "

Instructions

", "Update the myDog object's name property. Let's change her name from \"Coder\" to \"Happy Coder\". You can use either dot or bracket notation." ], - "tests": [ - "assert(/happy coder/gi.test(myDog.name), 'message: Update myDog's \"name\" property to equal \"Happy Coder\".');", - "assert(/\"name\": \"Coder\"/.test(code), 'message: Do not edit the myDog definition');" - ], "challengeSeed": [ "// Example", "var ourDog = {", @@ -3409,6 +3431,13 @@ "tail": [ "(function(z){return z;})(myDog);" ], + "solutions": [ + "var myDog = {\n \"name\": \"Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"]\n};\nmyDog.name = \"Happy Coder\";" + ], + "tests": [ + "assert(/happy coder/gi.test(myDog.name), 'message: Update myDog's \"name\" property to equal \"Happy Coder\".');", + "assert(/\"name\": \"Coder\"/.test(code), 'message: Do not edit the myDog definition');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3425,10 +3454,6 @@ "

Instructions

", "Add a \"bark\" property to myDog and set it to a dog sound, such as \"woof\". You may use either dot or bracket notation." ], - "tests": [ - "assert(myDog.bark !== undefined, 'message: Add the property \"bark\" to myDog.');", - "assert(!/bark[^\\n]:/.test(code), 'message: Do not add \"bark\" to the setup section');" - ], "challengeSeed": [ "// Example", "var ourDog = {", @@ -3457,6 +3482,10 @@ "solutions": [ "var myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"]\n};\nmyDog.bark = \"Woof Woof\";" ], + "tests": [ + "assert(myDog.bark !== undefined, 'message: Add the property \"bark\" to myDog.');", + "assert(!/bark[^\\n]:/.test(code), 'message: Do not add \"bark\" to the setup section');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3469,10 +3498,6 @@ "

Instructions

", "Delete the \"tails\" property from myDog. You may use either dot or bracket notation." ], - "tests": [ - "assert(myDog.tails === undefined, 'message: Delete the property \"tails\" from myDog.');", - "assert(code.match(/\"tails\": 1/g).length > 1, 'message: Do not modify the myDog setup');" - ], "challengeSeed": [ "// Example", "var ourDog = {", @@ -3504,6 +3529,10 @@ "solutions": [ "var ourDog = {\n \"name\": \"Camper\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"everything!\"],\n \"bark\": \"bow-wow\"\n};\n\nvar myDog = {\n \"name\": \"Happy Coder\",\n \"legs\": 4,\n \"tails\": 1,\n \"friends\": [\"Free Code Camp Campers\"],\n \"bark\": \"woof\"\n};\n\ndelete myDog.tails;" ], + "tests": [ + "assert(myDog.tails === undefined, 'message: Delete the property \"tails\" from myDog.');", + "assert(code.match(/\"tails\": 1/g).length > 1, 'message: Do not modify the myDog setup');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3518,16 +3547,6 @@ "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(phoneticLookup(\"alpha\") === 'Adams', 'message: phoneticLookup(\"alpha\") should equal \"Adams\"');", - "assert(phoneticLookup(\"bravo\") === 'Boston', 'message: phoneticLookup(\"bravo\") should equal \"Boston\"');", - "assert(phoneticLookup(\"charlie\") === 'Chicago', 'message: phoneticLookup(\"charlie\") should equal \"Chicago\"');", - "assert(phoneticLookup(\"delta\") === 'Denver', 'message: phoneticLookup(\"delta\") should equal \"Denver\"');", - "assert(phoneticLookup(\"echo\") === 'Easy', 'message: phoneticLookup(\"echo\") should equal \"Easy\"');", - "assert(phoneticLookup(\"foxtrot\") === 'Frank', 'message: phoneticLookup(\"foxtrot\") should equal \"Frank\"');", - "assert(typeof phoneticLookup(\"\") === 'undefined', 'message: phoneticLookup(\"\") should equal undefined');", - "assert(!/case|switch|if/g.test(code), 'message: You should not use case, switch, or if statements'); " - ], "challengeSeed": [ "// Setup", "function phoneticLookup(val) {", @@ -3562,6 +3581,16 @@ "solutions": [ "function phoneticLookup(val) {\n var result = \"\";\n\n var lookup = {\n alpha: \"Adams\",\n bravo: \"Boston\",\n charlie: \"Chicago\",\n delta: \"Denver\",\n echo: \"Easy\",\n foxtrot: \"Frank\"\n };\n\n result = lookup[val];\n\n return result;\n}" ], + "tests": [ + "assert(phoneticLookup(\"alpha\") === 'Adams', 'message: phoneticLookup(\"alpha\") should equal \"Adams\"');", + "assert(phoneticLookup(\"bravo\") === 'Boston', 'message: phoneticLookup(\"bravo\") should equal \"Boston\"');", + "assert(phoneticLookup(\"charlie\") === 'Chicago', 'message: phoneticLookup(\"charlie\") should equal \"Chicago\"');", + "assert(phoneticLookup(\"delta\") === 'Denver', 'message: phoneticLookup(\"delta\") should equal \"Denver\"');", + "assert(phoneticLookup(\"echo\") === 'Easy', 'message: phoneticLookup(\"echo\") should equal \"Easy\"');", + "assert(phoneticLookup(\"foxtrot\") === 'Frank', 'message: phoneticLookup(\"foxtrot\") should equal \"Frank\"');", + "assert(typeof phoneticLookup(\"\") === 'undefined', 'message: phoneticLookup(\"\") should equal undefined');", + "assert(!/case|switch|if/g.test(code), 'message: You should not use case, switch, or if statements'); " + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3581,11 +3610,6 @@ "Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return \"Not Found\"." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(checkObj(\"gift\") === \"pony\", 'message: checkObj(\"gift\") should return \"pony\".');", - "assert(checkObj(\"pet\") === \"kitten\", 'message: checkObj(\"gift\") should return \"kitten\".');", - "assert(checkObj(\"house\") === \"Not Found\", 'message: checkObj(\"house\") should return \"Not Found\".');" - ], "challengeSeed": [ "// Setup", "var myObj = {", @@ -3609,6 +3633,11 @@ "solutions": [ "var myObj = {\n gift: \"pony\",\n pet: \"kitten\",\n bed: \"sleigh\"\n};\nfunction checkObj(checkProp) {\n if(myObj.hasOwnProperty(checkProp)) {\n return myObj[checkProp];\n } else {\n return \"Not Found\";\n }\n}" ], + "tests": [ + "assert(checkObj(\"gift\") === \"pony\", 'message: checkObj(\"gift\") should return \"pony\".');", + "assert(checkObj(\"pet\") === \"kitten\", 'message: checkObj(\"gift\") should return \"kitten\".');", + "assert(checkObj(\"house\") === \"Not Found\", 'message: checkObj(\"house\") should return \"Not Found\".');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3624,17 +3653,6 @@ "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(Array.isArray(myMusic), 'message: myMusic should be an array');", - "assert(myMusic.length > 1, 'message: myMusic should have at least two elements');", - "assert(typeof myMusic[1] === 'object', 'message: myMusic[1] should be an object');", - "assert(Object.keys(myMusic[1]).length > 3, 'message: myMusic[1] should have at least 4 properties');", - "assert(myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string', 'message: myMusic[1] should contain an artist property which is a string');", - "assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string', 'message: myMusic[1] should contain a title property which is a string');", - "assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number', 'message: myMusic[1] should contain a release_year property which is a number');", - "assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats), 'message: myMusic[1] should contain a formats property which is an array');", - "assert(myMusic[1].formats.every(function(item) { return (typeof item === \"string\")}) && myMusic[1].formats.length > 1, 'message: formats should be an array of strings with at least two elements');" - ], "challengeSeed": [ "var myMusic = [", " {", @@ -3657,6 +3675,17 @@ "solutions": [ "var myMusic = [\n {\n \"artist\": \"Billy Joel\",\n \"title\": \"Piano Man\",\n \"release_year\": 1993,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\" ],\n \"gold\": true\n }, \n {\n \"artist\": \"ABBA\",\n \"title\": \"Ring Ring\",\n \"release_year\": 1973,\n \"formats\": [ \n \"CS\", \n \"8T\", \n \"LP\",\n \"CD\",\n ]\n }\n];" ], + "tests": [ + "assert(Array.isArray(myMusic), 'message: myMusic should be an array');", + "assert(myMusic.length > 1, 'message: myMusic should have at least two elements');", + "assert(typeof myMusic[1] === 'object', 'message: myMusic[1] should be an object');", + "assert(Object.keys(myMusic[1]).length > 3, 'message: myMusic[1] should have at least 4 properties');", + "assert(myMusic[1].hasOwnProperty('artist') && typeof myMusic[1].artist === 'string', 'message: myMusic[1] should contain an artist property which is a string');", + "assert(myMusic[1].hasOwnProperty('title') && typeof myMusic[1].title === 'string', 'message: myMusic[1] should contain a title property which is a string');", + "assert(myMusic[1].hasOwnProperty('release_year') && typeof myMusic[1].release_year === 'number', 'message: myMusic[1] should contain a release_year property which is a number');", + "assert(myMusic[1].hasOwnProperty('formats') && Array.isArray(myMusic[1].formats), 'message: myMusic[1] should contain a formats property which is an array');", + "assert(myMusic[1].formats.every(function(item) { return (typeof item === \"string\")}) && myMusic[1].formats.length > 1, 'message: formats should be an array of strings with at least two elements');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3676,10 +3705,6 @@ "Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(gloveBoxContents === \"maps\", 'message: gloveBoxContents should equal \"maps\"');", - "assert(/=\\s*myStorage\\.car\\.inside\\[(\"|')glove box\\1\\]/g.test(code), 'message: Use dot and bracket notation to access myStorage');" - ], "challengeSeed": [ "// Setup", "var myStorage = {", @@ -3710,6 +3735,10 @@ "solutions": [ "var myStorage = { \n \"car\":{ \n \"inside\":{ \n \"glove box\":\"maps\",\n \"passenger seat\":\"crumbs\"\n },\n \"outside\":{ \n \"trunk\":\"jack\"\n }\n }\n};\nvar gloveBoxContents = myStorage.car.inside[\"glove box\"];" ], + "tests": [ + "assert(gloveBoxContents === \"maps\", 'message: gloveBoxContents should equal \"maps\"');", + "assert(/=\\s*myStorage\\.car\\.inside\\[(\"|')glove box\\1\\]/g.test(code), 'message: Use dot and bracket notation to access myStorage');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3729,10 +3758,6 @@ "Retrieve the second tree from the variable myPlants using object dot and array bracket notation." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(secondTree === \"pine\", 'message: secondTree should equal \"pine\"');", - "assert(/=\\s*myPlants\\[1\\].list\\[1\\]/.test(code), 'message: Use dot and bracket notation to access myPlants');" - ], "challengeSeed": [ "// Setup", "var myPlants = [", @@ -3770,6 +3795,10 @@ "solutions": [ "var myPlants = [\n { \n type: \"flowers\",\n list: [\n \"rose\",\n \"tulip\",\n \"dandelion\"\n ]\n },\n {\n type: \"trees\",\n list: [\n \"fir\",\n \"pine\",\n \"birch\"\n ]\n } \n];\n\n// Only change code below this line\n\nvar secondTree = myPlants[1].list[1];" ], + "tests": [ + "assert(secondTree === \"pine\", 'message: secondTree should equal \"pine\"');", + "assert(/=\\s*myPlants\\[1\\].list\\[1\\]/.test(code), 'message: Use dot and bracket notation to access myPlants');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -3791,12 +3820,6 @@ "Always return the entire collection object." ], "releasedOn": "January 1, 2016", - "tests": [ - "collection = collectionCopy; assert(update(5439, \"artist\", \"ABBA\")[5439][\"artist\"] === \"ABBA\", 'message: After update(5439, \"artist\", \"ABBA\"), artist should be \"ABBA\"');", - "update(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After update(2548, \"artist\", \"\"), artist should not be set');", - "assert(update(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].length === 1, 'message: After update(1245, \"tracks\", \"Addicted to Love\"), tracks should have a length of 1');", - "update(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After update(2548, \"tracks\", \"\"), tracks should not be set');" - ], "challengeSeed": [ "// Setup", "var collection = {", @@ -3844,6 +3867,12 @@ "solutions": [ "var collection = {\n 2548: {\n album: \"Slippery When Wet\",\n artist: \"Bon Jovi\",\n tracks: [ \n \"Let It Rock\", \n \"You Give Love a Bad Name\" \n ]\n },\n 2468: {\n album: \"1999\",\n artist: \"Prince\",\n tracks: [ \n \"1999\", \n \"Little Red Corvette\" \n ]\n },\n 1245: {\n artist: \"Robert Palmer\",\n tracks: [ ]\n },\n 5439: {\n album: \"ABBA Gold\"\n }\n};\n// Keep a copy of the collection for tests\nvar collectionCopy = JSON.parse(JSON.stringify(collection));\n\n// Only change code below this line\nfunction update(id, prop, value) {\n if(value !== \"\") {\n if(prop === \"tracks\") {\n collection[id][prop].push(value);\n } else {\n collection[id][prop] = value;\n }\n } else {\n delete collection[id][prop];\n }\n\n return collection;\n}" ], + "tests": [ + "collection = collectionCopy; assert(update(5439, \"artist\", \"ABBA\")[5439][\"artist\"] === \"ABBA\", 'message: After update(5439, \"artist\", \"ABBA\"), artist should be \"ABBA\"');", + "update(2548, \"artist\", \"\"); assert(!collection[2548].hasOwnProperty(\"artist\"), 'message: After update(2548, \"artist\", \"\"), artist should not be set');", + "assert(update(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].length === 1, 'message: After update(1245, \"tracks\", \"Addicted to Love\"), tracks should have a length of 1');", + "update(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After update(2548, \"tracks\", \"\"), tracks should not be set');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -3869,10 +3898,6 @@ "

Instructions

", "Use a for loop to work to push the values 1 through 5 onto myArray." ], - "tests": [ - "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", - "assert.deepEqual(myArray, [1,2,3,4,5], 'message: myArray should equal [1,2,3,4,5].');" - ], "challengeSeed": [ "// Example", "var ourArray = [];", @@ -3891,6 +3916,13 @@ "tail": [ "if (typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" ], + "solutions": [ + "var ourArray = [];\nfor (var i = 0; i < 5; i++) {\n ourArray.push(i);\n}\nvar myArray = [];\nfor (var i = 1; i < 6; i++) {\n myArray.push(i);\n}" + ], + "tests": [ + "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", + "assert.deepEqual(myArray, [1,2,3,4,5], 'message: myArray should equal [1,2,3,4,5].');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3906,10 +3938,6 @@ "

Instructions

", "Push the odd numbers from 1 through 9 to myArray using a for loop." ], - "tests": [ - "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", - "assert.deepEqual(myArray, [1,3,5,7,9], 'message: myArray should equal [1,3,5,7,9].');" - ], "challengeSeed": [ "// Example", "var ourArray = [];", @@ -3928,6 +3956,13 @@ "tail": [ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" ], + "solutions": [ + "var ourArray = [];\nfor (var i = 0; i < 10; i += 2) {\n ourArray.push(i);\n}\nvar myArray = [];\nfor (var i = 1; i < 10; i += 2) {\n myArray.push(i);\n}" + ], + "tests": [ + "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", + "assert.deepEqual(myArray, [1,3,5,7,9], 'message: myArray should equal [1,3,5,7,9].');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3944,10 +3979,6 @@ "

Instructions

", "Push the odd numbers from 9 through 1 to myArray using a for loop." ], - "tests": [ - "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", - "assert.deepEqual(myArray, [9,7,5,3,1], 'message: myArray should equal [9,7,5,3,1].');" - ], "challengeSeed": [ "// Example", "var ourArray = [];", @@ -3965,6 +3996,13 @@ "tail": [ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" ], + "solutions": [ + "var ourArray = [];\nfor (var i = 10; i > 0; i -= 2) {\n ourArray.push(i);\n}\nvar myArray = [];\nfor (var i = 9; i > 0; i -= 2) {\n myArray.push(i);\n}" + ], + "tests": [ + "assert(code.match(/for\\s*\\(/g).length > 1, 'message: You should be using a for loop for this.');", + "assert.deepEqual(myArray, [9,7,5,3,1], 'message: myArray should equal [9,7,5,3,1].');" + ], "type": "waypoint", "challengeType": "1" }, @@ -3979,11 +4017,6 @@ "Create a variable total. Use a for loop to add each element of myArr to total." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(total !== 'undefined', 'message: total should be defined');", - "assert(total === 20, 'message: total should equal 20');", - "assert(!/20/.test(code), 'message: Do not set total to 20 directly');" - ], "challengeSeed": [ "// Example", "var ourArr = [ 9, 10, 11, 12];", @@ -4006,6 +4039,11 @@ "solutions": [ "var myArr = [ 2, 3, 4, 5, 6];\nvar total = 0;\n\nfor (var i = 0; i < myArr.length; i++) {\n total += myArr[i];\n}" ], + "tests": [ + "assert(total !== 'undefined', 'message: total should be defined');", + "assert(total === 20, 'message: total should equal 20');", + "assert(!/20/.test(code), 'message: Do not set total to 20 directly');" + ], "type": "waypoint", "challengeType": "1", "nameCn": "", @@ -4025,11 +4063,6 @@ "Modify function multiplyAll so that it multiplies product by each number in the subarrays of arr" ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(multiplyAll([[1],[2],[3]]) === 6, 'message: multiplyAll([[1],[2],[3]]); should return 6');", - "assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, 'message: multiplyAll([[1,2],[3,4],[5,6,7]]) should return 5040');", - "assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, 'message: multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]);) should return 54');" - ], "challengeSeed": [ "function multiplyAll(arr) {", " var product = 1;", @@ -4047,7 +4080,12 @@ "" ], "solutions": [ - "function multiplyAll(arr) {\n var product = 1;\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr[i].length; j++) {\n product *= arr[i][j];\n }\n }\n return product;\n}\n\nmultiplyAll([[1,2],[3,4],[5,6,7]]);\n\n" + "function multiplyAll(arr) {\n var product = 1;\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr[i].length; j++) {\n product *= arr[i][j];\n }\n }\n return product;\n}\n\nmultiplyAll([[1,2],[3,4],[5,6,7]]);" + ], + "tests": [ + "assert(multiplyAll([[1],[2],[3]]) === 6, 'message: multiplyAll([[1],[2],[3]]); should return 6');", + "assert(multiplyAll([[1,2],[3,4],[5,6,7]]) === 5040, 'message: multiplyAll([[1,2],[3,4],[5,6,7]]) should return 5040');", + "assert(multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]) === 54, 'message: multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]]);) should return 54');" ], "type": "waypoint", "challengeType": "1", @@ -4068,10 +4106,6 @@ "

Instructions

", "Push the numbers 0 through 4 to myArray using a while loop." ], - "tests": [ - "assert(code.match(/while/g), 'message: You should be using a while loop for this.');", - "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray should equal [0,1,2,3,4].');" - ], "challengeSeed": [ "// Setup", "var myArray = [];", @@ -4083,6 +4117,13 @@ "tail": [ "if(typeof(myArray) !== \"undefined\"){(function(){return myArray;})();}" ], + "solutions": [ + "var myArray = [];\nvar i = 0;\nwhile(i < 5) {\n myArray.push(i);\n i++;\n}" + ], + "tests": [ + "assert(code.match(/while/g), 'message: You should be using a while loop for this.');", + "assert.deepEqual(myArray, [0,1,2,3,4], 'message: myArray should equal [0,1,2,3,4].');" + ], "type": "waypoint", "challengeType": "1" }, @@ -4096,12 +4137,6 @@ "The provided code transforms the input into an array for you, codeArr. Place the decoded values into the decodedArr array where the provided code will transform it back into a string." ], "releasedOn": "January 1, 2016", - "tests": [ - "assert(rot13(\"SERR PBQR PNZC\") === \"FREE CODE CAMP\", 'message: rot13(\"SERR PBQR PNZC\") should decode to \"FREE CODE CAMP\"');", - "assert(rot13(\"SERR CVMMN!\") === \"FREE PIZZA!\", 'message: rot13(\"SERR CVMMN!\") should decode to \"FREE PIZZA!\"');", - "assert(rot13(\"SERR YBIR?\") === \"FREE LOVE?\", 'message: rot13(\"SERR YBIR?\") should decode to \"FREE LOVE?\"');", - "assert(rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") === \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\", 'message: rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") should decode to \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\"');" - ], "challengeSeed": [ "function rot13(encodedStr) {", " var codeArr = encodedStr.split(\"\"); // String to Array", @@ -4123,6 +4158,12 @@ "solutions": [ "var lookup = {\n 'A': 'N','B': 'O','C': 'P','D': 'Q',\n 'E': 'R','F': 'S','G': 'T','H': 'U',\n 'I': 'V','J': 'W','K': 'X','L': 'Y',\n 'M': 'Z','N': 'A','O': 'B','P': 'C',\n 'Q': 'D','R': 'E','S': 'F','T': 'G',\n 'U': 'H','V': 'I','W': 'J','X': 'K',\n 'Y': 'L','Z': 'M' \n};\n\nfunction rot13(encodedStr) {\n var codeArr = encodedStr.split(\"\"); // String to Array\n var decodedArr = []; // Your Result goes here\n // Only change code below this line\n \n decodedArr = codeArr.map(function(letter) {\n if(lookup.hasOwnProperty(letter)) {\n letter = lookup[letter];\n }\n return letter;\n });\n\n // Only change code above this line\n return decodedArr.join(\"\"); // Array to String\n}" ], + "tests": [ + "assert(rot13(\"SERR PBQR PNZC\") === \"FREE CODE CAMP\", 'message: rot13(\"SERR PBQR PNZC\") should decode to \"FREE CODE CAMP\"');", + "assert(rot13(\"SERR CVMMN!\") === \"FREE PIZZA!\", 'message: rot13(\"SERR CVMMN!\") should decode to \"FREE PIZZA!\"');", + "assert(rot13(\"SERR YBIR?\") === \"FREE LOVE?\", 'message: rot13(\"SERR YBIR?\") should decode to \"FREE LOVE?\"');", + "assert(rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") === \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\", 'message: rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") should decode to \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\"');" + ], "type": "bonfire", "challengeType": "5", "nameCn": "", @@ -4136,14 +4177,11 @@ "title": "Generate Random Fractions with JavaScript", "description": [ "Random numbers are useful for creating random behavior.", - "JavaScript has a Math.random() function that generates a random decimal number.", - "Change myFunction to return a random number instead of returning 0.", - "Note that you can return a function, just like you would return a variable or value." - ], - "tests": [ - "assert(typeof(myFunction()) === \"number\", 'message: myFunction should return a random number.');", - "assert((myFunction()+''). match(/\\./g), 'message: The number returned by myFunction should be a decimal.');", - "assert(code.match(/Math\\.random/g).length >= 0, 'message: You should be using Math.random to generate the random decimal number.');" + "JavaScript has a Math.random() function that generates a random decimal number between 0 (inclusive) and not quite up to 1 (exclusive). Thus Math.random() can return a 0 but never quite return a 1", + "Note", + "Like Storing Values with the Equal Operator, all function calls will be resolved before the return executes, so we can simply return the value of the Math.random() function.", + "

Instructions

", + "Change myFunction to return a random number instead of returning 0." ], "challengeSeed": [ "function myFunction() {", @@ -4158,6 +4196,14 @@ "tail": [ "(function(){return myFunction();})();" ], + "solutions": [ + "function myFunction() {\n return Math.random();\n}" + ], + "tests": [ + "assert(typeof(myFunction()) === \"number\", 'message: myFunction should return a random number.');", + "assert((myFunction()+''). match(/\\./g), 'message: The number returned by myFunction should be a decimal.');", + "assert(code.match(/Math\\.random/g).length >= 0, 'message: You should be using Math.random to generate the random decimal number.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -4165,22 +4211,12 @@ "id": "cf1111c1c12feddfaeb1bdef", "title": "Generate Random Whole Numbers with JavaScript", "description": [ - "It's great that we can generate random decimal numbers, but it's even more useful if we use it to generate random whole numbers.", - "First, let's use Math.random() to generate a random decimal.", - "Then let's multiply this random decimal by 20.", - "Finally, let's use another function, Math.floor() to round the number down to its nearest whole number.", - "This technique will gives us a whole number between 0 and 19.", - "Note that because we're rounding down, it's impossible to actually get 20.", + "It's great that we can generate random decimal numbers, but it's even more useful if we use it to generate random whole numbers.
  1. Use Math.random() to generate a random decimal.
  2. Multiply that random decimal by 20.
  3. Use another function, Math.floor() to round the number down to its nearest whole number.
Remember that Math.random() can never quite return a 1 and, because we're rounding down, it's impossible to actually get 20. This technique will gives us a whole number between 0 and 19.", "Putting everything together, this is what our code looks like:", "Math.floor(Math.random() * 20);", "See how Math.floor takes (Math.random() * 20) as its argument? That's right - you can pass a function to another function as an argument.", - "Let's use this technique to generate and return a random whole number between 0 and 9." - ], - "tests": [ - "assert(typeof(myFunction()) === \"number\" && (function(){var r = myFunction();return Math.floor(r) === r;})(), 'message: The result of myFunction should be a whole number.');", - "assert(code.match(/Math.random/g).length > 1, 'message: You should be using Math.random to generate a random number.');", - "assert(code.match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || code.match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'message: You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine.');", - "assert(code.match(/Math.floor/g).length > 1, 'message: You should use Math.floor to remove the decimal part of the number.');" + "

Instructions

", + "Use this technique to generate and return a random whole number between 0 and 9." ], "challengeSeed": [ "var randomNumberBetween0and19 = Math.floor(Math.random() * 20);", @@ -4195,6 +4231,15 @@ "tail": [ "(function(){return myFunction();})();" ], + "solutions": [ + "var randomNumberBetween0and19 = Math.floor(Math.random() * 20);\n\nfunction myFunction() {\n return Math.floor(Math.random() * 10);\n}" + ], + "tests": [ + "assert(typeof(myFunction()) === \"number\" && (function(){var r = myFunction();return Math.floor(r) === r;})(), 'message: The result of myFunction should be a whole number.');", + "assert(code.match(/Math.random/g).length > 1, 'message: You should be using Math.random to generate a random number.');", + "assert(code.match(/\\(\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\*\\s*?10\\s*?\\)/g) || code.match(/\\(\\s*?10\\s*?\\*\\s*?Math.random\\s*?\\(\\s*?\\)\\s*?\\)/g), 'message: You should have multiplied the result of Math.random by 10 to make it a number that is between zero and nine.');", + "assert(code.match(/Math.floor/g).length > 1, 'message: You should use Math.floor to remove the decimal part of the number.');" + ], "type": "waypoint", "challengeType": "1" }, @@ -4206,40 +4251,53 @@ "To do this, we'll define a minimum number min and a maximum number max.", "Here's the formula we'll use. Take a moment to read it and try to understand what this code is doing:", "Math.floor(Math.random() * (max - min + 1)) + min", - "Define two variables: myMin and myMax, and set them both equal to numbers.", - "Then create a function called myFunction that returns a random number that's greater than or equal to myMin, and is less than or equal to myMax." - ], - "tests": [ - "assert(myFunction() >= myMin, 'message: The random number generated by myFunction should be greater than or equal to your minimum number, myMin.');", - "assert(myFunction() <= myMax, 'message: The random number generated by myFunction should be less than or equal to your maximum number, myMax.');", - "assert(myFunction() % 1 === 0 , 'message: The random number generated by myFunction should be an integer, not a decimal.');", - "assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), 'message: myFunction() should use use both myMax and myMin, and return a random number in your range.');" + "

Instructions

", + "Create a function called randomRange that takes a range myMin and myMax and returns a random number that's greater than or equal to myMin, and is less than or equal to myMax, inclusive." ], "challengeSeed": [ - "var ourMin = 1;", - "", - "var ourMax = 9;", - "", - "function ourFunction() {", + "// Example", + "function ourFunction(ourMin, ourMax) {", "", " return Math.floor(Math.random() * (ourMax - ourMin + 1)) + ourMin;", - "", "}", "", + "ourFunction(1, 9);", + "", "// Only change code below this line.", "", - "var myMin;", + "function randomRange(myMin, myMax) {", "", - "var myMax;", + " return 0; // Change this line", "", - "function myFunction() {", + "}", "", - " return;", - "", - "}" + "// Change these values to test your function", + "var myRandom = randomRange(5, 15);" ], "tail": [ - "(function(){return myFunction();})();" + "var calcMin = 100;", + "var calcMax = -100;", + "for(var i = 0; i < 100; i++) {", + " var result = randomRange(5,15);", + " calcMin = Math.min(calcMin, result);", + " calcMax = Math.max(calcMax, result);", + "}", + "(function(){", + " if(typeof myRandom === 'number') {", + " return \"myRandom = \" + myRandom;", + " } else {", + " return \"myRandom undefined\";", + " }", + "})();" + ], + "solutions": [ + "function randomRange(myMin, myMax) {\n return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;\n}" + ], + "tests": [ + "assert(calcMin === 5, 'message: The random number generated by myFunction should be greater than or equal to your minimum number, myMin.');", + "assert(calcMax === 15, 'message: The random number generated by myFunction should be less than or equal to your maximum number, myMax.');", + "assert(randomRange(0,1) % 1 === 0 , 'message: The random number generated by myFunction should be an integer, not a decimal.');", + "assert((function(){if(code.match(/myMax/g).length > 1 && code.match(/myMin/g).length > 2 && code.match(/Math.floor/g) && code.match(/Math.random/g)){return true;}else{return false;}})(), 'message: myFunction() should use use both myMax and myMin, and return a random number in your range.');" ], "type": "waypoint", "challengeType": "1" @@ -4251,37 +4309,46 @@ "Regular expressions are used to find certain words or patterns inside of strings.", "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:", + "/ is the start of the regular expression.", "the is the pattern we want to match.", - "g means that we want to search the entire string for this pattern instead of just the first match.", + "/ is the end of the regular expression.", + "g means global, which causes the pattern to return all matches in the string, not just the first one.", "i means that we want to ignore the case (uppercase or lowercase) when searching for the pattern.", - "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 word and." - ], - "tests": [ - "assert(test==2, 'message: Your regular expression should find two occurrences of the word and.');", - "assert(code.match(/\\/and\\/gi/), 'message: Use regular expressions to find the word and in testString.');" + "

Instructions

", + "Select all the occurrences of the word and in testString.", + "You can do this by replacing the . part of the regular expression with the word and." ], "head": [ "" ], "challengeSeed": [ "// Setup", - "var test = (function() {", - " // Example", - " var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";", - " var expressionToGetSoftware = /software/gi;", + "var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";", "", - " // Only change code below this line.", + "// Example", + "var expressionToGetSoftware = /software/gi;", + "var softwareCount = testString.match(expressionToGetSoftware).length;", + " ", "", - " var expression = /./gi;", + "// Only change code below this line.", "", - " // Only change code above this line", - " return testString.match(expression).length;", - "})();(function(){return test;})();" + "var expression = /./gi; // Change this Line", + "", + "// Only change code above this line", + "", + "// This code counts the matches of expression in testString", + "var andCount = testString.match(expression).length;", + "" ], "tail": [ - "" + "(function(){return andCount;})();" + ], + "solutions": [ + "var testString = \"Ada Lovelace and Charles Babbage designed the first computer and the software that would have run on it.\";\nvar expression = /and/gi; // Change this Line\nvar andCount = testString.match(expression).length;" + ], + "tests": [ + "assert(andCount==2, 'message: Your regular expression should find two occurrences of the word and.');", + "assert(code.match(/\\/and\\/gi/), 'message: Use regular expressions to find the word and in testString.');" ], "type": "waypoint", "challengeType": "1" @@ -4293,29 +4360,35 @@ "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 retrieve the numbers in a 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(code.match(/\\/\\\\d\\+\\//g), 'message: Use the /\\d+/g regular expression to find the numbers in testString.');", - "assert(test === 2, 'message: Your regular expression should find two numbers in testString.');" + "For numbers this is often written as /\\d+/g, where the + following the digit selector allows this regular expression to match one or more numbers.", + "

Instructions

", + "Use the \\d selector to select the number of numbers in the string, allowing for the possibility of one or more digit." ], "head": [ - "var test = (function() {" - ], - "challengeSeed": [ - "var test = (function() {", - "", - " var testString = \"There are 3 cats but 4 dogs.\";", - "", - " // Only change code below this line.", - "", - " var expression = /.+/g;", "" ], + "challengeSeed": [ + "// Setup", + "var testString = \"There are 3 cats but 4 dogs.\";", + "", + "// Only change code below this line.", + "", + "var expression = /.+/g; // Change this line", + "", + "// Only change code above this line", + "", + "// This code counts the matches of expression in testString", + "var digitCount = testString.match(expression).length;" + ], "tail": [ - " return testString.match(expression).length;", - "})();(function(){return test;})();" + "(function(){return digitCount;})();" + ], + "solutions": [ + "var testString = \"There are 3 cats but 4 dogs.\";\nvar expression = /\\d+/g; // Change this line\nvar digitCount = testString.match(expression).length;" + ], + "tests": [ + "assert(digitCount === 2, 'message: Your regular expression should find two numbers in testString.');", + "assert(code.match(/\\/\\\\d\\+\\//g), 'message: Use the /\\d+/g regular expression to find the numbers in testString.');" ], "type": "waypoint", "challengeType": "1" @@ -4328,27 +4401,34 @@ "The whitespace characters are \" \" (space), \\r (the carriage return), \\n (newline), \\t (tab), and \\f (the form feed).", "The whitespace regular expression looks like this:", "/\\s+/g", - "Use it to select all the whitespace characters in the sentence string." - ], - "tests": [ - "assert(code.match(/\\/\\\\s\\+\\//g), 'message: Use the /\\s+/g regular expression to find the spaces in testString.');", - "assert(test === 7, 'message: Your regular expression should find seven spaces in testString.');" + "

Instructions

", + "Use \\s to select all the whitespace characters in the sentence string." ], "head": [ - "var test = (function() {" - ], - "challengeSeed": [ - " var testString = \"How many spaces are there in this sentence?\";", - "", - " // Only change code below this line.", - "", - " var expression = /.+/g;", "" ], - "tail": [ - " return testString.match(expression).length;", + "challengeSeed": [ + "// Setup", + "var testString = \"How many spaces are there in this sentence?\";", "", - "})();(function(){return test;})();" + "// Only change code below this line.", + "", + "var expression = /.+/g; // Change this line", + "", + "// Only change code above this line", + "", + "// This code counts the matches of expression in testString", + "var spaceCount = testString.match(expression).length;" + ], + "tail": [ + "(function(){return spaceCount;})();" + ], + "solutions": [ + "var testString = \"How many spaces are there in this sentence?\";\nvar expression = /\\s+/g; // Change this line\nvar spaceCount = testString.match(expression).length;" + ], + "tests": [ + "assert(spaceCount === 7, 'message: Your regular expression should find seven spaces in testString.');", + "assert(code.match(/\\/\\\\s\\+\\//g), 'message: Use the /\\s+/g regular expression to find the spaces in testString.');" ], "type": "waypoint", "challengeType": "1" @@ -4359,26 +4439,34 @@ "description": [ "You can invert any match by using the uppercase version of the regular expression selector.", "For example, \\s will match any whitespace, and \\S will match anything that isn't whitespace.", + "

Instructions

", "Use /\\S/g to count the number of non-whitespace characters in testString." ], - "tests": [ - "assert(code.match(/\\/\\\\S\\/g/g), 'message: Use the /\\S/g regular expression to find non-space characters in testString.');", - "assert(test === 49, 'message: Your regular expression should find forty nine non-space characters in the testString.');" - ], "head": [ - "var test = (function() {" - ], - "challengeSeed": [ - " var testString = \"How many non-space characters are there in this sentence?\";", - "", - " // Only change code below this line.", - "", - " var expression = /./g;", "" ], + "challengeSeed": [ + "// Setup", + "var testString = \"How many non-space characters are there in this sentence?\";", + "", + "// Only change code below this line.", + "", + "var expression = /.+/g; // Change this line", + "", + "// Only change code above this line", + "", + "// This code counts the matches of expression in testString", + "var nonSpaceCount = testString.match(expression).length;" + ], "tail": [ - " return testString.match(expression).length;", - "})();(function(){return test;})();" + "(function(){return nonSpaceCount;})();" + ], + "solutions": [ + "var testString = \"How many non-space characters are there in this sentence?\";\nvar expression = /\\S/g; \nvar nonSpaceCount = testString.match(expression).length;" + ], + "tests": [ + "assert(nonSpaceCount === 49, 'message: Your regular expression should find forty nine non-space characters in the testString.');", + "assert(code.match(/\\/\\\\S\\/g/g), 'message: Use the /\\S/g regular expression to find non-space characters in testString.');" ], "type": "waypoint", "challengeType": "1" @@ -4386,7 +4474,6 @@ { "id": "cf1111c1c12feddfaeb9bdef", "title": "Create a JavaScript Slot Machine", - "isBeta": "true", "description": [ "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.", @@ -4394,12 +4481,6 @@ "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\" && runSlots($(\".slot\"))[0] > 0 && runSlots($(\".slot\"))[0] < 4, 'slotOne should be a random number.')", - "assert(typeof(runSlots($(\".slot\"))[1]) === \"number\" && runSlots($(\".slot\"))[1] > 0 && runSlots($(\".slot\"))[1] < 4, 'slotTwo should be a random number.')", - "assert(typeof(runSlots($(\".slot\"))[2]) === \"number\" && runSlots($(\".slot\"))[2] > 0 && runSlots($(\".slot\"))[2] < 4, '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(/slot.*?=.*?\\(.*?\\).*?/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", " function runSlots() {", @@ -4535,13 +4616,22 @@ " }", "" ], + "solutions": [ + "" + ], + "tests": [ + "assert(typeof(runSlots($(\".slot\"))[0]) === \"number\" && runSlots($(\".slot\"))[0] > 0 && runSlots($(\".slot\"))[0] < 4, 'slotOne should be a random number.')", + "assert(typeof(runSlots($(\".slot\"))[1]) === \"number\" && runSlots($(\".slot\"))[1] > 0 && runSlots($(\".slot\"))[1] < 4, 'slotTwo should be a random number.')", + "assert(typeof(runSlots($(\".slot\"))[2]) === \"number\" && runSlots($(\".slot\"))[2] > 0 && runSlots($(\".slot\"))[2] < 4, '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(/slot.*?=.*?\\(.*?\\).*?/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.')" + ], "type": "waypoint", - "challengeType": "0" + "challengeType": "0", + "isBeta": "true" }, { "id": "cf1111c1c13feddfaeb1bdef", "title": "Add your JavaScript Slot Machine Slots", - "isBeta": "true", "description": [ "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 and we should return null.", @@ -4553,9 +4643,6 @@ "Also, we need to show the user that he has won the game when he gets the same number in all the slots.", "If all three numbers match, we should also set the text \"It's A Win\" to the element with class logger." ], - "tests": [ - "assert((function(){var data = runSlots();return data === null || data.toString().length === 1;})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.')" - ], "challengeSeed": [ "fccss", " function runSlots() {", @@ -4695,13 +4782,19 @@ " }", "" ], + "solutions": [ + "" + ], + "tests": [ + "assert((function(){var data = runSlots();return data === null || data.toString().length === 1;})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null.')" + ], "type": "waypoint", - "challengeType": "0" + "challengeType": "0", + "isBeta": "true" }, { "id": "cf1111c1c13feddfaeb2bdef", "title": "Bring your JavaScript Slot Machine to Life", - "isBeta": "true", "description": [ "Now we can detect a win. Let's get this slot machine working.", "Let's use the jQuery selector $(\".slot\") to select all of the slots.", @@ -4710,10 +4803,6 @@ "This jQuery will select the first slot and update it's HTML to display the correct number.", "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((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", " function runSlots() {", @@ -4861,13 +4950,20 @@ " }", "" ], + "solutions": [ + "" + ], + "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((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.')" + ], "type": "waypoint", - "challengeType": "0" + "challengeType": "0", + "isBeta": "true" }, { "id": "cf1111c1c11feddfaeb1bdff", "title": "Give your JavaScript Slot Machine some Stylish Images", - "isBeta": "true", "description": [ "Now let's add some images to our slots.", "We've already set up the images for you in an array called images. We can use different indexes to grab each of these.", @@ -4875,15 +4971,6 @@ "$($('.slot')[0]).html('<img src = \"' + images[slotOne-1] + '\">');", "Set up all three slots like this, then click the \"Go\" button to play the slot machine." ], - "tests": [ - "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", " function runSlots() {", @@ -5035,8 +5122,21 @@ " }", "" ], + "solutions": [ + "" + ], + "tests": [ + "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.')" + ], "type": "waypoint", - "challengeType": "0" + "challengeType": "0", + "isBeta": "true" } ] -} +} \ No newline at end of file From 6e7cadb2e7982a6ea1f5c34724001b53c58e64ff Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 29 Dec 2015 17:40:20 -0800 Subject: [PATCH 130/174] Load random commit if none specified --- server/boot/commit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/boot/commit.js b/server/boot/commit.js index 37f8559436..8d5805ee2a 100644 --- a/server/boot/commit.js +++ b/server/boot/commit.js @@ -44,7 +44,7 @@ function findNonprofit(name) { }); } - nonprofit = nonprofit || nonprofits[0]; + nonprofit = nonprofit || nonprofits[ _.random(0, nonprofits.length - 1) ]; return nonprofit; } From 1960a421e111a77578718828a70507847a3f5241 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Tue, 29 Dec 2015 20:35:04 -0600 Subject: [PATCH 131/174] continue improving challenges as I record videos --- .../basic-ziplines.json | 8 ++++---- .../intermediate-ziplines.json | 12 ++++++------ .../data-visualization-projects.json | 10 +++++----- .../react-projects.json | 14 +++++++------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-ziplines.json b/seed/challenges/01-front-end-development-certification/basic-ziplines.json index 39da7f228c..48dbb33a93 100644 --- a/seed/challenges/01-front-end-development-certification/basic-ziplines.json +++ b/seed/challenges/01-front-end-development-certification/basic-ziplines.json @@ -110,7 +110,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/VemmoX/.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can access all of the portfolio webpage's content just by scrolling.", "User Story: I can click different buttons that will take me to the portfolio creator's different social media pages.", @@ -179,7 +179,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/yeVgBY.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can click a button to show me a new random quote.", "User Story: I can press a button to tweet out a quote.", @@ -232,7 +232,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/EPNZYW.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can add, subtract, multiply and divide two numbers.", "User Story: I can clear the input field with a clear button.", @@ -275,7 +275,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/VemPZX.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can start a 25 minute pomodoro, and the timer will go off once 25 minutes has elapsed.", "User Story: I can reset the clock for my next pomodoro.", diff --git a/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json b/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json index 06cff7be52..5d281b2eaa 100644 --- a/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json +++ b/seed/challenges/01-front-end-development-certification/intermediate-ziplines.json @@ -11,7 +11,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/avqvgJ.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can see the weather in my current location.", "User Story: I can see a different icon or background image (e.g. snowy mountain, hot desert) depending on the weather.", @@ -70,7 +70,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/pgNRoJ.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can browse recent posts from Camper News.", "User Story: I can click on a post to be taken to the story's original URL.", @@ -115,7 +115,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/pgNRvJ.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can search Wikipedia entries in a search box and see the resulting Wikipedia entries.", "User Story: I can click a button to see a random Wikipedia entry.", @@ -160,7 +160,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBpOw.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can see whether Free Code Camp is currently streaming on Twitch.tv.", "User Story: I can click the status output and be sent directly to the Free Code Camp's Twitch.tv channel.", @@ -229,7 +229,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBpvw.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I can play a game of Tic Tac Toe with the computer.", "User Story: I can never actually win against the computer - at best I can tie.", @@ -274,7 +274,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/obYBjE.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "User Story: I am presented with a random series of button presses.", "User Story: each time I input a series of button presses correctly, I see the same series of button presses but with an additional step.", diff --git a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json index 9ac4e3991e..8ac5e5f6d7 100644 --- a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json +++ b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json @@ -11,7 +11,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBBWd.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use D3.js to build this project.", "User Story: I can see US Gross Domestic Product by quarter, over time.", @@ -43,7 +43,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/GoNNEy.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use D3.js to build this project.", "User Story: I can see performance time visualized in a scatterplot graph.", @@ -75,7 +75,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/rxWWGa.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use D3.js to build this project.", "User Story: I can view a heat map of the temperature by month, sorted into rows by year.", @@ -108,7 +108,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/KVNNXY.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use D3.js to build this project.", "User Story: I can see a Force-directed Graph that shows which campers are posting links on Camper News to which domains.", @@ -143,7 +143,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/mVEJag.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use D3.js to build this project.", "User Story: I can see where all Meteorites landed on a world map.", diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index 2a10238b7b..b479f90600 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -11,7 +11,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/obYYqW.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use both SASS and React to build this project.", "User Story: I can type GitHub-flavored Markdown into a text area.", @@ -37,16 +37,16 @@ }, { "id": "bd7156d8c242eddfaeb5bd13", - "title": "Build an Camper Leaderboard", + "title": "Build a Camper Leaderboard", "challengeSeed": [ "133315782" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/qbqqJm/.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use both SASS and React to build this project.", - "User Story: I can see the a table of the Free Code Camp campers who've earned the most brownie points in the past 30 days.", + "User Story: I can see a table of the Free Code Camp campers who've earned the most brownie points in the past 30 days.", "User Story: I can see how many brownie points they've earned in the past 30 days, and how many they've earned total.", "User Story: I can toggle between sorting the list by how many bronwie points they've earned in the past 30 days and by how many brownie points they've earned total.", "Hint: To get the top 100 campers for the last 30 days: http://fcctop100.herokuapp.com/api/fccusers/recent/:sortColumnName.", @@ -77,7 +77,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/LGbbqj.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use both SASS and React to build this project.", "User Story: I can create recipes that have names and ingredients.", @@ -112,7 +112,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOrZ.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use both SASS and React to build this project.", "User Story: When I first arrive at the game, it will randomly generate a board and start playing.", @@ -148,7 +148,7 @@ ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOEJ/.", - "Rule #1: Don't look at the example project's code on CodePen. Figure it out for yourself.", + "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use both SASS and React to build this project.", "User Story: I have health, a level, and a weapon. I can pick up a better weapon. I can pick up health items.", From c1f0b383c8df8059479dfcf2c4691864a888e492 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 30 Dec 2015 00:10:36 -0600 Subject: [PATCH 132/174] more challenge improvements --- .../react-projects.json | 11 ++++++----- .../api-projects.json | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index b479f90600..c69d86120b 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -87,7 +87,7 @@ "User Story: I can delete these recipes.", "User Story: All new recipes I add are saved in my browser's local storage. If I refresh the page, these recipes will still be there.", "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. ", + "When you are finished, click the \"I've completed this challenge\" button and include a link to your CodePen.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], "type": "zipline", @@ -106,7 +106,7 @@ }, { "id": "bd7154d8c242eddfaeb5bd13", - "title": "Build the Conway Game of Life", + "title": "Build Conway's Game of Life", "challengeSeed": [ "133315782" ], @@ -121,6 +121,7 @@ "User Story: I can clear the board.", "User Story: When I press start, the game will play out.", "User Story: Each time the board changes, I can see how many generations have gone by.", + "Hint: Here's an explanation of Conway's Game of Life from John Conway himself: https://www.youtube.com/watch?v=E8kUJL04ELA", "Hint: Here's an overview of Conway's Game of Life with rules for your reference: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life", "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. ", @@ -154,10 +155,10 @@ "User Story: I have health, a level, and a weapon. I can pick up a better weapon. I can pick up health items.", "User Story: All the items and enemies on the map are arranged at random.", "User Story: I can move throughout a map, discovering items.", - "User Story: I can move anywhere within the map's boundaries , but I can't move through an enemy until I've beaten it.", - "User Story: Much of the map is hidden. When I take a step, all spaces that are within a certain number of space from me are revealed.", + "User Story: I can move anywhere within the map's boundaries, but I can't move through an enemy until I've beaten it.", + "User Story: Much of the map is hidden. When I take a step, all spaces that are within a certain number of spaces from me are revealed.", "User Story: When I beat an enemy, the enemy goes away and I get XP, which eventually increases my level.", - "User Story: When I fight an enemy, we take turns damaging each other until one of us loses. I do damage is based off of my level and my weapon. The enemy does damage based off of its level. Damage is somewhat random within a range.", + "User Story: When I fight an enemy, we take turns damaging each other until one of us loses. I do damage based off of my level and my weapon. The enemy does damage based off of its level. Damage is somewhat random within a range.", "User Story: When I find and beat the boss, I win.", "User Story: The game should be challenging, but theoretically winnable.", "Remember to use Read-Search-Ask if you get stuck.", diff --git a/seed/challenges/03-back-end-development-certification/api-projects.json b/seed/challenges/03-back-end-development-certification/api-projects.json index edfb4b5b99..befbc45bbc 100644 --- a/seed/challenges/03-back-end-development-certification/api-projects.json +++ b/seed/challenges/03-back-end-development-certification/api-projects.json @@ -282,7 +282,7 @@ }, { "id": "bd7158d8c443edefaeb5bdee", - "title": "API Project 5", + "title": "Image Search Abstraction Layer", "challengeSeed": [ "133315784" ], @@ -290,9 +290,9 @@ "Objective: Build a full stack JavaScript app that is functionally similar to this: https://cryptic-ridge-9197.herokuapp.com/api/latest/imagesearch/ and deploy it to Heroku.", "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", "Here are the specific user stories you should implement for this Basejump:", - "User Story: ", - "User Story: ", - "User Story: ", + "User Story: I can get the image URLs, alt text and page urls for a set of images relating to a given search string.", + "User Story: I can paginate through the responses by adding a ?offset=2 parameter to the URL.", + "User Story: I can get a list of the most recently submitted search strings.", "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.", "You can get feedback on your project from fellow campers by sharing it in our Code Review Chatroom. You can also share it on Twitter and your city's Campsite (on Facebook)." ], @@ -312,7 +312,7 @@ }, { "id": "bd7158d8c443edefaeb5bd0f", - "title": "Filesize Checker", + "title": "File Metadata Microservice", "challengeSeed": [ "133315784" ], From a9ff687ce8c248fc6804e9c1ab1e0ca28c183741 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Tue, 29 Dec 2015 22:35:03 -0800 Subject: [PATCH 133/174] Minor fixes from QA --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0e93d4581f..c20cd9793a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -129,7 +129,7 @@ "assert(/var a;/.test(code) && /var b = 2;/.test(code), 'message: Do not change code above the line');", "assert(typeof a === 'number' && a === 7, 'message: a should have a value of 7');", "assert(typeof b === 'number' && b === 7, 'message: b should have a value of 7');", - "assert(/b\\s*=\\s*a\\s*;/g.test(code) > 0, 'message: a should be assigned to b with =');" + "assert(/b\\s*=\\s*a\\s*;/g.test(code), 'message: a should be assigned to b with =');" ], "type": "waypoint", "challengeType": "1", @@ -146,7 +146,7 @@ "It is common to initialize a variable to an initial value in the same line as it is declared.", "", "var myVar = 0;", - "Creates a new variable called myVar and assigns it an inital value of 0.", + "Creates a new variable called myVar and assigns it an initial value of 0.", "", "

Instructions

", "Define a variable a with var and initialize it to a value of 9." @@ -984,7 +984,7 @@ "description": [ "We can also use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.", "

Instructions

", - "Build myStr over several lines by concatenating these two strings:
\"This is the first sentance. \" and \"This is the second sentance.\" using the += operator." + "Build myStr over several lines by concatenating these two strings:
\"This is the first sentence. \" and \"This is the second sentence.\" using the += operator." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -999,10 +999,10 @@ "" ], "solutions": [ - "var ourStr = \"I come first. \";\nourStr += \"I come second.\";\n\nvar myStr = \"This is the first sentance. \";\nmyStr += \"This is the second sentance.\";" + "var ourStr = \"I come first. \";\nourStr += \"I come second.\";\n\nvar myStr = \"This is the first sentence. \";\nmyStr += \"This is the second sentence.\";" ], "tests": [ - "assert(myStr === \"This is the first sentance. This is the second sentance.\", 'message: myStr should have a value of This is the first sentance. This is the second sentance.');", + "assert(myStr === \"This is the first sentence. This is the second sentence.\", 'message: myStr should have a value of This is the first sentence. This is the second sentence.');", "assert(code.match(/\\w\\s*\\+=\\s*\"/g).length > 1 && code.match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" ], "type": "waypoint", From c3005cf7f85e17eeaed663659c0e3b6c9acf2719 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 30 Dec 2015 01:20:35 -0600 Subject: [PATCH 134/174] update certificate requirements --- .../front-end-development-certificate.json | 2 +- .../data-visualization-certificate.json | 73 +++++- .../react-projects.json | 2 +- .../back-end-development-certificate.json | 235 +++--------------- 4 files changed, 97 insertions(+), 215 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/front-end-development-certificate.json b/seed/challenges/01-front-end-development-certification/front-end-development-certificate.json index 7ebd78a9dc..c32a398d0a 100644 --- a/seed/challenges/01-front-end-development-certification/front-end-development-certificate.json +++ b/seed/challenges/01-front-end-development-certification/front-end-development-certificate.json @@ -35,7 +35,7 @@ [ "http://i.imgur.com/16SIhHO.jpg", "An image of the word \"Congratulations\"", - "Congratulations! We've added your Front End Development Certificate to your certificate to your portfolio page. Unless you choose to hide your solutions, this certificate will remain publicly visible and verifiable.", + "Congratulations! We've added your Front End Development Certificate to your portfolio page. Unless you choose to hide your solutions, this certificate will remain publicly visible and verifiable.", "" ] ], diff --git a/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json b/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json index 3232eb8bb2..bd16bd795e 100644 --- a/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json +++ b/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json @@ -1,6 +1,5 @@ { "name": "Claim Your Data Visualization Certificate", - "isComingSoon": true, "order": 18, "time": "5m", "challenges": [ @@ -9,16 +8,25 @@ "title": "Claim Your Data Visualization Certificate", "challengeSeed": [ { - "properties": ["isHonest", "isDataVisualizationCert"], - "apis": ["/certificate/honest", "/certificate/verify/data-visualization"], - "stepIndex": [1, 2] + "properties": [ + "isHonest", + "isDataVisualizationCert" + ], + "apis": [ + "/certificate/honest", + "/certificate/verify/data-visualization" + ], + "stepIndex": [ + 1, + 2 + ] } ], "description": [ [ "http://i.imgur.com/syJxavV.jpg", - "An image of our Front End Development Certificate", - "This challenge will give you your verified Front End Development Certificate. Before we issue your certificate, we must verify that you have completed all of our basic and intermediate Bonfires, and all our basic and intermediate Ziplines. You must also accept our Academic Honesty Pledge. Click the button below to start this process.", + "An image of our Data Visualization Certificate", + "This challenge will give you your verified Data Visualization Certificate. Before we issue your certificate, we must verify that you have completed all of our basic and intermediate Bonfires, and all our basic and intermediate Ziplines. You must also accept our Academic Honesty Pledge. Click the button below to start this process.", "" ], [ @@ -29,20 +37,61 @@ ], [ "http://i.imgur.com/14F2Van.jpg", - "An image of the text \"Front End Development Certificate requirements\"", - "Let's confirm that you have completed all of our basic and intermediate Bonfires, and all our basic and intermediate Ziplines. Click the button below to verify this.", + "An image of the text \"Data Visualization Certificate requirements\"", + "Let's confirm that you have completed our React and D3.js Ziplines. Click the button below to verify this.", "#" ], [ "http://i.imgur.com/16SIhHO.jpg", "An image of the word \"Congratulations\"", - "Congratulations! We've added your Front End Development Certificate to your certificate to your portfolio page. Unless you choose to hide your solutions, this certificate will remain publicly visible and verifiable.", + "Congratulations! We've added your Data Visualization Certificate to your portfolio page. Unless you choose to hide your solutions, this certificate will remain publicly visible and verifiable.", "" ] ], "type": "Waypoint", "challengeType": 7, - "tests": [], + "tests": [ + { + "id": "bd7157d8c242eddfaeb5bd13", + "title": "Build a Markdown Previewer" + }, + { + "id": "bd7156d8c242eddfaeb5bd13", + "title": "Build a Camper Leaderboard" + }, + { + "id": "bd7155d8c242eddfaeb5bd13", + "title": "Build a Recipe Box" + }, + { + "id": "bd7154d8c242eddfaeb5bd13", + "title": "Build the Game of Life" + }, + { + "id": "bd7153d8c242eddfaeb5bd13", + "title": "Build a Roguelike Dungeon Crawler Game" + }, + { + "id": "bd7168d8c242eddfaeb5bd13", + "title": "Visualize Data with a Bar Chart" + }, + { + "id": "bd7178d8c242eddfaeb5bd13", + "title": "Visualize Data with a Scatterplot Graph" + }, + { + "id": "bd7188d8c242eddfaeb5bd13", + "title": "Visualize Data with a Heat Map" + }, + { + "id": "bd7198d8c242eddfaeb5bd13", + "title": "Show Relationships with a Force-Directed Graph" + }, + { + "id": "bd7108d8c242eddfaeb5bd13", + "title": "Map Data Across the Globe" + } + ], "nameCn": "", "descriptionCn": [], "nameFr": "", @@ -75,9 +124,9 @@ "¡Felicitaciones! Hemos agregado tu Certificado de desarrollo Front End a tu portafolio. A menos que elijas no mostrar tus soluciones, este certificado será públicamente visible y verificable.", "" ] - ], + ], "namePt": "", "descriptionPt": [] } ] -} +} \ No newline at end of file diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index c69d86120b..9eabdf3d2c 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -106,7 +106,7 @@ }, { "id": "bd7154d8c242eddfaeb5bd13", - "title": "Build Conway's Game of Life", + "title": "Build the Game of Life", "challengeSeed": [ "133315782" ], diff --git a/seed/challenges/03-back-end-development-certification/back-end-development-certificate.json b/seed/challenges/03-back-end-development-certification/back-end-development-certificate.json index d388c3ac51..80a6b3b432 100644 --- a/seed/challenges/03-back-end-development-certification/back-end-development-certificate.json +++ b/seed/challenges/03-back-end-development-certification/back-end-development-certificate.json @@ -8,9 +8,18 @@ "title": "Claim Your Back End Development Certificate", "challengeSeed": [ { - "properties": ["isHonest", "isBackEndCert"], - "apis": ["/certificate/honest", "/certificate/verify/back-end"], - "stepIndex": [1, 2] + "properties": [ + "isHonest", + "isBackEndCert" + ], + "apis": [ + "/certificate/honest", + "/certificate/verify/back-end" + ], + "stepIndex": [ + 1, + 2 + ] } ], "description": [ @@ -29,211 +38,19 @@ [ "http://i.imgur.com/2qn7tHp.jpg", "An image of the text \"Back End Development Certificate requirements\"", - "Let's confirm that you have completed all of our Bonfires, Ziplines and Basejumps. Click the button below to verify this.", + "Let's confirm that you have completed our upper intermediate and advanced Bonfires, and our Basejumps. Click the button below to verify this.", "#" ], [ "http://i.imgur.com/16SIhHO.jpg", "An image of the word \"Congratulations\"", - "Congratulations! We've added your Full Stack Development Certificate to your certificate to your portfolio page. Unless you choose to hide your solutions, this certificate will remain publicly visible and verifiable.", + "Congratulations! We've added your Back End Development Certificate to your portfolio page. Unless you choose to hide your solutions, this certificate will remain publicly visible and verifiable.", "" ] ], "type": "Waypoint", "challengeType": 7, "tests": [ - { - "id": "ad7123c8c441eddfaeb5bdef", - "title": "Meet Bonfire" - }, - { - "id": "a202eed8fc186c8434cb6d61", - "title": "Reverse a String" - }, - { - "id": "a302f7aae1aa3152a5b413bc", - "title": "Factorialize a Number" - }, - { - "id": "aaa48de84e1ecc7c742e1124", - "title": "Check for Palindromes" - }, - { - "id": "a26cbbe9ad8655a977e1ceb5", - "title": "Find the Longest Word in a String" - }, - { - "id": "ab6137d4e35944e21037b769", - "title": "Title Case a Sentence" - }, - { - "id": "a789b3483989747d63b0e427", - "title": "Return Largest Numbers in Arrays" - }, - { - "id": "acda2fb1324d9b0fa741e6b5", - "title": "Confirm the Ending" - }, - { - "id": "afcc8d540bea9ea2669306b6", - "title": "Repeat a string repeat a string" - }, - { - "id": "ac6993d51946422351508a41", - "title": "Truncate a string" - }, - { - "id": "a9bd25c716030ec90084d8a1", - "title": "Chunky Monkey" - }, - { - "id": "ab31c21b530c0dafa9e241ee", - "title": "Slasher Flick" - }, - { - "id": "af2170cad53daa0770fabdea", - "title": "Mutations" - }, - { - "id": "adf08ec01beb4f99fc7a68f2", - "title": "Falsy Bouncer" - }, - { - "id": "a39963a4c10bc8b4d4f06d7e", - "title": "Seek and Destroy" - }, - { - "id": "a24c1a4622e3c05097f71d67", - "title": "Where do I belong" - }, - { - "id": "a3566b1109230028080c9345", - "title": "Sum All Numbers in a Range" - }, - { - "id": "a5de63ebea8dbee56860f4f2", - "title": "Diff Two Arrays" - }, - { - "id": "a7f4d8f2483413a6ce226cac", - "title": "Roman Numeral Converter" - }, - { - "id": "a8e512fbe388ac2f9198f0fa", - "title": "Where art thou" - }, - { - "id": "a0b5010f579e69b815e7c5d6", - "title": "Search and Replace" - }, - { - "id": "aa7697ea2477d1316795783b", - "title": "Pig Latin" - }, - { - "id": "afd15382cdfb22c9efe8b7de", - "title": "DNA Pairing" - }, - { - "id": "af7588ade1100bde429baf20", - "title": "Missing letters" - }, - { - "id": "a77dbc43c33f39daa4429b4f", - "title": "Boo who" - }, - { - "id": "a105e963526e7de52b219be9", - "title": "Sorted Union" - }, - { - "id": "a6b0bb188d873cb2c8729495", - "title": "Convert HTML Entities" - }, - { - "id": "a103376db3ba46b2d50db289", - "title": "Spinal Tap Case" - }, - { - "id": "a5229172f011153519423690", - "title": "Sum All Odd Fibonacci Numbers" - }, - { - "id": "a3bfc1673c0526e06d3ac698", - "title": "Sum All Primes" - }, - { - "id": "ae9defd7acaf69703ab432ea", - "title": "Smallest Common Multiple" - }, - { - "id": "a6e40f1041b06c996f7b2406", - "title": "Finders Keepers" - }, - { - "id": "a5deed1811a43193f9f1c841", - "title": "Drop it" - }, - { - "id": "ab306dbdcc907c7ddfc30830", - "title": "Steamroller" - }, - { - "id": "a8d97bd4c764e91f9d2bda01", - "title": "Binary Agents" - }, - { - "id": "a10d2431ad0c6a099a4b8b52", - "title": "Everything Be True" - }, - { - "id": "a97fd23d9b809dac9921074f", - "title": "Arguments Optional" - }, - { - "id": "bd7158d8c442eddfbeb5bd1f", - "title": "Get Set for Ziplines" - }, - { - "id": "bd7158d8c242eddfaeb5bd13", - "title": "Build a Personal Portfolio Webpage" - }, - { - "id": "bd7158d8c442eddfaeb5bd13", - "title": "Build a Random Quote Machine" - }, - { - "id": "bd7158d8c442eddfaeb5bd0f", - "title": "Build a Pomodoro Clock" - }, - { - "id": "bd7158d8c442eddfaeb5bd17", - "title": "Build a JavaScript Calculator" - }, - { - "id": "bd7158d8c442eddfaeb5bd10", - "title": "Show the Local Weather" - }, - { - "id": "bd7158d8c442eddfaeb5bd1f", - "title": "Use the Twitch.tv JSON API" - }, - { - "id": "bd7158d8c442eddfaeb5bd18", - "title": "Stylize Stories on Camper News" - }, - { - "id": "bd7158d8c442eddfaeb5bd19", - "title": "Build a Wikipedia Viewer" - }, - { - "id": "bd7158d8c442eedfaeb5bd1c", - "title": "Build a Tic Tac Toe Game" - }, - { - "id": "bd7158d8c442eddfaeb5bd1c", - "title": "Build a Simon Game" - }, { "id": "a2f1d72d9b908d0bd72bb9f6", "title": "Make a Person" @@ -271,8 +88,24 @@ "title": "Friendly Date Ranges" }, { - "id": "bd7158d8c443eddfaeb5bcef", - "title": "Get Set for Basejumps" + "id": "bd7158d8c443edefaeb5bdef", + "title": "Timestamp Microservice" + }, + { + "id": "bd7158d8c443edefaeb5bdff", + "title": "Request Header Parser Microservice" + }, + { + "id": "bd7158d8c443edefaeb5bd0e", + "title": "URL Shortener Microservice" + }, + { + "id": "bd7158d8c443edefaeb5bdee", + "title": "Image Search Abstraction Layer" + }, + { + "id": "bd7158d8c443edefaeb5bd0f", + "title": "File Metadata Microservice" }, { "id": "bd7158d8c443eddfaeb5bdef", @@ -327,9 +160,9 @@ "¡Felicitaciones! Hemos agregado tu Certificado de desarrollo Full Stack a tu portafolio. A menos que elijas no mostrar tus soluciones, este certificado será públicamente visible y verificable.", "" ] - ], + ], "namePt": "", "descriptionPt": [] } ] -} +} \ No newline at end of file From fb096db7e6f1e73daec54d0a7ed212da93e8e88a Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 30 Dec 2015 03:57:33 -0600 Subject: [PATCH 135/174] add video links --- .../data-visualization-certificate.json | 2 +- .../data-visualization-projects.json | 18 +++++++++--------- .../react-projects.json | 10 +++++----- .../api-projects.json | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json b/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json index bd16bd795e..75a77bbd9e 100644 --- a/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json +++ b/seed/challenges/02-data-visualization-certification/data-visualization-certificate.json @@ -85,7 +85,7 @@ }, { "id": "bd7198d8c242eddfaeb5bd13", - "title": "Show Relationships with a Force-Directed Graph" + "title": "Show Relationships with a Force Directed Graph" }, { "id": "bd7108d8c242eddfaeb5bd13", diff --git a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json index 8ac5e5f6d7..45efa1afae 100644 --- a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json +++ b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json @@ -7,7 +7,7 @@ "id": "bd7168d8c242eddfaeb5bd13", "title": "Visualize Data with a Bar Chart", "challengeSeed": [ - "133315782" + "150324699" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBBWd.", @@ -39,7 +39,7 @@ "id": "bd7178d8c242eddfaeb5bd13", "title": "Visualize Data with a Scatterplot Graph", "challengeSeed": [ - "133315782" + "150324700" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/GoNNEy.", @@ -71,16 +71,16 @@ "id": "bd7188d8c242eddfaeb5bd13", "title": "Visualize Data with a Heat Map", "challengeSeed": [ - "133315782" + "150324701" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/rxWWGa.", "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", "Rule #3: You must use D3.js to build this project.", - "User Story: I can view a heat map of the temperature by month, sorted into rows by year.", - "User Story: Each month is colored based on its relative heat.", - "User Story: I can hover over a month to get its exact temperature.", + "User Story: I can view a heat map with data represented both on the Y and X axis.", + "User Story: Each cell is colored based its relationship to other data.", + "User Story: I can mouse over a cell in the heat map to get more exact information.", "Hint: Here's a dataset you can use to build this: https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/global-temperature.json", "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. ", @@ -102,9 +102,9 @@ }, { "id": "bd7198d8c242eddfaeb5bd13", - "title": "Show Relationships with a Force-Directed Graph", + "title": "Show Relationships with a Force Directed Graph", "challengeSeed": [ - "133315782" + "150324458" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/KVNNXY.", @@ -139,7 +139,7 @@ "id": "bd7108d8c242eddfaeb5bd13", "title": "Map Data Across the Globe", "challengeSeed": [ - "133315782" + "150324698" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/mVEJag.", diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index 9eabdf3d2c..35227d1383 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -7,7 +7,7 @@ "id": "bd7157d8c242eddfaeb5bd13", "title": "Build a Markdown Previewer", "challengeSeed": [ - "133315782" + "150324697" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/obYYqW.", @@ -39,7 +39,7 @@ "id": "bd7156d8c242eddfaeb5bd13", "title": "Build a Camper Leaderboard", "challengeSeed": [ - "133315782" + "150324694" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/qbqqJm/.", @@ -73,7 +73,7 @@ "id": "bd7155d8c242eddfaeb5bd13", "title": "Build a Recipe Box", "challengeSeed": [ - "133315782" + "150324695" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/LGbbqj.", @@ -108,7 +108,7 @@ "id": "bd7154d8c242eddfaeb5bd13", "title": "Build the Game of Life", "challengeSeed": [ - "133315782" + "150324459" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOrZ.", @@ -145,7 +145,7 @@ "id": "bd7153d8c242eddfaeb5bd13", "title": "Build a Roguelike Dungeon Crawler Game", "challengeSeed": [ - "133315782" + "150324693" ], "description": [ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOEJ/.", diff --git a/seed/challenges/03-back-end-development-certification/api-projects.json b/seed/challenges/03-back-end-development-certification/api-projects.json index befbc45bbc..d8b5b281dc 100644 --- a/seed/challenges/03-back-end-development-certification/api-projects.json +++ b/seed/challenges/03-back-end-development-certification/api-projects.json @@ -196,7 +196,7 @@ "id": "bd7158d8c443edefaeb5bdef", "title": "Timestamp Microservice", "challengeSeed": [ - "133315784" + "150324691" ], "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: https://timestamp-ms.herokuapp.com/ and deploy it to Heroku.", @@ -226,7 +226,7 @@ "id": "bd7158d8c443edefaeb5bdff", "title": "Request Header Parser Microservice", "challengeSeed": [ - "133315784" + "150324460" ], "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: https://cryptic-ridge-9197.herokuapp.com/api/whoami/ and deploy it to Heroku.", @@ -254,7 +254,7 @@ "id": "bd7158d8c443edefaeb5bd0e", "title": "URL Shortener Microservice", "challengeSeed": [ - "133315784" + "150324692" ], "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: https://shurli.herokuapp.com/ and deploy it to Heroku.", @@ -284,10 +284,10 @@ "id": "bd7158d8c443edefaeb5bdee", "title": "Image Search Abstraction Layer", "challengeSeed": [ - "133315784" + "150324461" ], "description": [ - "Objective: Build a full stack JavaScript app that is functionally similar to this: https://cryptic-ridge-9197.herokuapp.com/api/latest/imagesearch/ and deploy it to Heroku.", + "Objective: Build a full stack JavaScript app that allows you to search for images like this: https://cryptic-ridge-9197.herokuapp.com/api/imagesearch/lolcats%20funny?offset=10 and browse recent search queries like this: https://cryptic-ridge-9197.herokuapp.com/api/latest/imagesearch/. Then deploy it to Heroku.", "Note that for each Basejump, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit http://freecodecamp.com/challenges/get-set-for-basejumps.", "Here are the specific user stories you should implement for this Basejump:", "User Story: I can get the image URLs, alt text and page urls for a set of images relating to a given search string.", @@ -314,7 +314,7 @@ "id": "bd7158d8c443edefaeb5bd0f", "title": "File Metadata Microservice", "challengeSeed": [ - "133315784" + "150324457" ], "description": [ "Objective: Build a full stack JavaScript app that is functionally similar to this: https://cryptic-ridge-9197.herokuapp.com/ and deploy it to Heroku.", From 4a42ff7f05a1803fe96d81f82551f54d428065c0 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 31 Dec 2015 00:55:29 +0530 Subject: [PATCH 136/174] Basic Javascript Waypoint fixes --- .../basic-javascript.json | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c20cd9793a..d8f1a5c093 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -99,7 +99,7 @@ "id": "56533eb9ac21ba0edf2244a8", "title": "Storing Values with the Equal Operator", "description": [ - "In Javascript, you can store a value in a variable with the assignment or equal (=) operator.", + "In JavaScript, you can store a value in a variable with the assignment or equal (=) operator.", "myVariable = 5;", "Assigns the Number value 5 to myVariable.", "Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.", @@ -107,7 +107,7 @@ "myNum = myVar;", "Assigns 5 to myVar and then resolves myVar to 5 again and assigns it to myNum.", "

Instructions

", - "Assign the value 7 to variable a", + "Assign the value 7 to variable a", "Assign the contents of a to variable b." ], "releasedOn": "January 1, 2016", @@ -1853,7 +1853,7 @@ "id": "56533eb9ac21ba0edf2244be", "title": "Global Scope and Functions", "description": [ - "In Javascript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means, they can be seen everywhere in your JavaScript code.", + "In JavaScript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope. This means, they can be seen everywhere in your JavaScript code.", "Variables which are used without the var keyword are automatically created in the global scope. This can create unintended consequences elsewhere in your code or when running a function again. You should always declare your variables with var.", "

Instructions

", "Declare a global variable myGlobal outside of any function. Initialize it to have a value of 10 ", @@ -1911,7 +1911,7 @@ "assert(myGlobal === 10, 'message: myGlobal should have a value of 10');", "assert(/var\\s+myGlobal/.test(code), 'message: myGlobal should be declared using the var keyword');", "assert(typeof oopsGlobal != \"undefined\" && oopsGlobal === 5, 'message: oopsGlobal should have a value of 5');", - "assert(!/var\\s+oopsGlobal/.test(code), 'message: Do not decalre oopsGlobal using the var keyword');" + "assert(!/var\\s+oopsGlobal/.test(code), 'message: Do not declare oopsGlobal using the var keyword');" ], "type": "waypoint", "challengeType": "1", @@ -3350,7 +3350,7 @@ "id": "56533eb9ac21ba0edf2244c9", "title": "Accessing Objects Properties with Variables", "description": [ - "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for iterating through lists of object properties or for doing lookup.", + "Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for iterating through lists of the object properties or for doing the lookup.", "Here is an example of using a variable to access a property:", "
var someProp = \"propName\";
var myObj = {
propName: \"Some Value\"
}
myObj[someProp]; // \"Some Value\"
", "Note that we do not use quotes around the variable name when using it to access the property because we are using the value of the variable, not the name", @@ -3620,7 +3620,7 @@ "", "function checkObj(checkProp) {", " // Your Code Here", - "", + " ", " return \"Change Me!\";", "}", "", @@ -3645,12 +3645,12 @@ "id": "56533eb9ac21ba0edf2244cb", "title": "Introducing JavaScript Object Notation (JSON)", "description": [ - "JavaScript Object Notation or JSON uses the format of Javascript Objects to store data. JSON is flexible becuase it allows for data structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects. ", + "JavaScript Object Notation or JSON uses the format of JavaScript Objects to store data. JSON is flexible because it allows for Data Structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects.", "Here is an example of a JSON object:", "
var ourMusic = [
{
\"artist\": \"Daft Punk\",
\"title\": \"Homework\",
\"release_year\": 1997,
\"formats\": [
\"CD\",
\"Cassette\",
\"LP\" ],
\"gold\": true
}
];
", - "This is an array of objects and the object has various pieces of metadata about an album. It also has a nested array of formats. Additional album records could be added to the top level array.", + "This is an array of objects and the object has various pieces of metadata about an album. It also has a nested formats array. Additional album records could be added to the top level array.", "

Instructions

", - "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." + "Add a new album to the myMusic JSON object. Add artist and title strings, release_year year, and a formats array of strings." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -4057,17 +4057,17 @@ "title": "Nesting For Loops", "description": [ "If you have a multi-dimensional array, you can use the same logic as the prior waypoint to loop through both the array and any sub-arrays. Here is an example:", - "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; k < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", - "This outputs each sub-element in arr one at a time. Note that for the inner loop we are checking the .length of arr[i], since arr[i] is itself an array.", + "
var arr = [
[1,2], [3,4], [5,6]
];
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) {
console.log(arr[i][j]);
}
}
", + "This outputs each sub-element in arr one at a time. Note that for the inner loop, we are checking the .length of arr[i], since arr[i] is itself an array.", "

Instructions

", - "Modify function multiplyAll so that it multiplies product by each number in the subarrays of arr" + "Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr" ], "releasedOn": "January 1, 2016", "challengeSeed": [ "function multiplyAll(arr) {", " var product = 1;", " // Only change code below this line", - "", + " ", " // Only change code above this line", " return product;", "}", @@ -4142,9 +4142,9 @@ " var codeArr = encodedStr.split(\"\"); // String to Array", " var decodedArr = []; // Your Result goes here", " // Only change code below this line", - "", - "", - "", + " ", + " ", + " ", " // Only change code above this line", " return decodedArr.join(\"\"); // Array to String", "}", @@ -5139,4 +5139,4 @@ "isBeta": "true" } ] -} \ No newline at end of file +} From bcdc546bade5a06d87538dd84676bdec9a903cfd Mon Sep 17 00:00:00 2001 From: Waqas Ahmed Date: Wed, 30 Dec 2015 23:34:09 +0400 Subject: [PATCH 137/174] Provides clarity about overriding of id over classes --- .../html5-and-css.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/html5-and-css.json b/seed/challenges/01-front-end-development-certification/html5-and-css.json index 2207ee7d55..98aea66769 100644 --- a/seed/challenges/01-front-end-development-certification/html5-and-css.json +++ b/seed/challenges/01-front-end-development-certification/html5-and-css.json @@ -3597,7 +3597,8 @@ "Create a CSS declaration for your orange-text id in your style element. Here's an example of what this looks like:", "#brown-text {", "  color: brown;", - "}" + "}", + "Note: It doesn't matter whether you declare this css above or below pink-text class, since id attribute will always take precedence." ], "tests": [ "assert($(\"h1\").hasClass(\"pink-text\"), 'message: Your h1 element should have the class pink-text.');", @@ -3642,7 +3643,8 @@ "Crea una declaración CSS para tu identificación orange-text en tu elemento style. He aquí un ejemplo de como se ve esto: ", "#brown-text {", "  color: brown;", - "}" + "}", + "Nota: No importa si usted declara este css encima o debajo de la clase de texto de color rosa, ya atributo id siempre tendrá prioridad." ], "namePt": "", "descriptionPt": [], From c10a086bb65fcdbffd53373c0ccf5bf509e5f409 Mon Sep 17 00:00:00 2001 From: BKinahan Date: Wed, 30 Dec 2015 19:46:04 +0000 Subject: [PATCH 138/174] Lowercase 'Solo' in 'Face-melting guitar Solo' Changed the case of Solo in the message 'Face-melting guitar Solo' because, unless there's an extremely subtle Star Wars reference I'm missing, solo isn't a proper noun here. --- server/utils/resources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/resources.json b/server/utils/resources.json index c80b9dafa7..9f588aef8b 100644 --- a/server/utils/resources.json +++ b/server/utils/resources.json @@ -76,7 +76,7 @@ "By the power of Grayskull!", "You did it!", "Storm that castle!", - "Face-melting guitar Solo!", + "Face-melting guitar solo!", "Checkmate!", "Bodacious!", "Tubular!", From d0d4f6c1378f98ac423f2205e34d6baa752c8d11 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 30 Dec 2015 13:54:31 -0600 Subject: [PATCH 139/174] turn SASS into Sass per their rebranding --- .../react-projects.json | 10 +++++----- .../02-data-visualization-certification/sass.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index 35227d1383..460edcd382 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -13,7 +13,7 @@ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/obYYqW.", "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "Rule #3: You must use both SASS and React to build this project.", + "Rule #3: You must use both Sass and React to build this project.", "User Story: I can type GitHub-flavored Markdown into a text area.", "User Story: I can see a preview of the output of my markdown that is updated as I type.", "Hint: You don't need to interperate Markdown yourself - you can import the Marked library for this: https://cdnjs.com/libraries/marked", @@ -45,7 +45,7 @@ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/qbqqJm/.", "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "Rule #3: You must use both SASS and React to build this project.", + "Rule #3: You must use both Sass and React to build this project.", "User Story: I can see a table of the Free Code Camp campers who've earned the most brownie points in the past 30 days.", "User Story: I can see how many brownie points they've earned in the past 30 days, and how many they've earned total.", "User Story: I can toggle between sorting the list by how many bronwie points they've earned in the past 30 days and by how many brownie points they've earned total.", @@ -79,7 +79,7 @@ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/LGbbqj.", "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "Rule #3: You must use both SASS and React to build this project.", + "Rule #3: You must use both Sass and React to build this project.", "User Story: I can create recipes that have names and ingredients.", "User Story: I can see an index view where the names of all the recipes are visible.", "User Story: I can click into any of those recipes to view it.", @@ -114,7 +114,7 @@ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOrZ.", "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "Rule #3: You must use both SASS and React to build this project.", + "Rule #3: You must use both Sass and React to build this project.", "User Story: When I first arrive at the game, it will randomly generate a board and start playing.", "User Story: I can start and stop the board.", "User Story: I can set up the board.", @@ -151,7 +151,7 @@ "Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/dGOOEJ/.", "Rule #1: Don't look at the example project's code. Figure it out for yourself.", "Rule #2: Fulfill the below user stories. Use whichever libraries or APIs you need. Give it your own personal style.", - "Rule #3: You must use both SASS and React to build this project.", + "Rule #3: You must use both Sass and React to build this project.", "User Story: I have health, a level, and a weapon. I can pick up a better weapon. I can pick up health items.", "User Story: All the items and enemies on the map are arranged at random.", "User Story: I can move throughout a map, discovering items.", diff --git a/seed/challenges/02-data-visualization-certification/sass.json b/seed/challenges/02-data-visualization-certification/sass.json index 8afa10d1c0..1a908b2e90 100644 --- a/seed/challenges/02-data-visualization-certification/sass.json +++ b/seed/challenges/02-data-visualization-certification/sass.json @@ -1,12 +1,12 @@ { - "name": "SASS", + "name": "Sass", "order": 13, "isComingSoon": true, "time": "5h", "challenges": [ { "id": "bd7158d8c423ede2aeb5bdee", - "title": "Learn SASS Challenges", + "title": "Learn Sass Challenges", "challengeSeed": [], "description": [ ], From c4015bf16a94ed6520bd09a0b0ad857f97866928 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 31 Dec 2015 02:30:33 +0530 Subject: [PATCH 140/174] Iterate Through an Array with a For Loop Fix instruction in Waypoint: Iterate Through an Array with a For Loop --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index d8f1a5c093..38fccc2552 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -4014,7 +4014,7 @@ "
var arr = [10,9,8,7,6];
for (var i=0; i < arr.length; i++) {
console.log(arr[i]);
}
", "Remember that Arrays have zero-based numbering, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops when i is at length - 1.", "

Instructions

", - "Create a variable total. Use a for loop to add each element of myArr to total." + "Declare and initialize a variable total to 0. Use a for loop to add the value of each element of the myArr array to total." ], "releasedOn": "January 1, 2016", "challengeSeed": [ From ba0a360c49fc6ea19efacb5c5c6b2b5fcdfdb1d2 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 30 Dec 2015 13:18:48 -0800 Subject: [PATCH 141/174] Improve increment and decrement instructions, tests --- .../basic-javascript.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index d8f1a5c093..f0ae23b709 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -393,6 +393,7 @@ "i++;", "is the equivalent of", "i = i + 1;", + "Note
The entire line becomes i++;, eliminating the need for the equal sign.", "

Instructions

", "Change the code to use the ++ operator on myVar" ], @@ -412,7 +413,7 @@ ], "tests": [ "assert(myVar === 88, 'message: myVar should equal 88');", - "assert(/[+]{2}/.test(code), 'message: Use the ++ operator');", + "assert(/myVar\\s*[+]{2}/.test(code), 'message: Use the ++ operator');", "assert(/var myVar = 87;/.test(code), 'message: Do not change code above the line');" ], "type": "waypoint", @@ -431,6 +432,7 @@ "i--;", "is the equivalent of", "i = i - 1;", + "Note
The entire line becomes i--;, eliminating the need for the equal sign.", "

Instructions

", "Change the code to use the -- operator on myVar" ], @@ -450,7 +452,7 @@ ], "tests": [ "assert(myVar === 10, 'message: myVar should equal 10');", - "assert(/myVar[-]{2}/.test(code), 'message: Use the -- operator on myVar');", + "assert(/myVar\\s*[-]{2}/.test(code), 'message: Use the -- operator on myVar');", "assert(/var myVar = 11;/.test(code), 'message: Do not change code above the line');" ], "type": "waypoint", @@ -5139,4 +5141,4 @@ "isBeta": "true" } ] -} +} \ No newline at end of file From 4c8e119108adf0c7ce525d810d7d924bd40794fb Mon Sep 17 00:00:00 2001 From: BKinahan Date: Wed, 30 Dec 2015 21:28:59 +0000 Subject: [PATCH 142/174] Add two missing semi-colons to challenge seeds Added missing semi-colons to two challenge seeds to have proper syntax and match challenge seeds for similar waypoints. Closes #5575 --- .../01-front-end-development-certification/html5-and-css.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/html5-and-css.json b/seed/challenges/01-front-end-development-certification/html5-and-css.json index 985bc8e252..15edf6e964 100644 --- a/seed/challenges/01-front-end-development-certification/html5-and-css.json +++ b/seed/challenges/01-front-end-development-certification/html5-and-css.json @@ -4181,7 +4181,7 @@ "challengeSeed": [ "" ], @@ -4222,7 +4222,7 @@ "challengeSeed": [ "" ], From fd52588090130451fdb7f8a0e1e6c05c61a5b802 Mon Sep 17 00:00:00 2001 From: "Dr. Paul Kenneth Shreeman" Date: Wed, 30 Dec 2015 16:49:41 -0600 Subject: [PATCH 143/174] Squashing three commits... Made a minor adjustment in instruction to prevent confusion regards to variable use of item Added more clarifications Clarification Phase 2 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c1505e3792..4f7297bd92 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2098,7 +2098,7 @@ "title": "Stand in Line", "description": [ "In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.", - "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove and return the item at the front of the queue." + "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove and return the first element of the array." ], "releasedOn": "January 1, 2016", "head": [ @@ -5141,4 +5141,4 @@ "isBeta": "true" } ] -} \ No newline at end of file +} From a6011f47d72d1ecfafd4d735de0db074d81e05e5 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 31 Dec 2015 06:01:47 +0530 Subject: [PATCH 144/174] Fix Using Objects for Lookups description --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c1505e3792..d1c7b5c92e 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3544,7 +3544,7 @@ "description": [ "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.", "Here is an example of a simple reverse alphabet lookup:", - "
var alpha = {
1:\"Z\",
2:\"Y\",
3:\"X\",
...
4:\"W\",
24:\"C\",
25:\"B\",
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", + "
var alpha = {
1:\"Z\",
2:\"Y\",
3:\"X\",
4:\"W\",
...
24:\"C\",
25:\"B\",
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", "

Instructions

", "Convert the switch statement into a lookup table called lookup. Use it to lookup val and return the associated string." ], From 9254fd1ff90ad2b31a232aa59fef522eaccf2470 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 31 Dec 2015 06:11:32 +0530 Subject: [PATCH 145/174] Fix Accessing Objects Properties with Bracket Notation output --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c1505e3792..1adcfbdeac 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3328,7 +3328,7 @@ "var drinkValue = testObj; // Change this line" ], "tail": [ - "(function(a,b) { return \"entreeValue = '\" + a + \"', shirtValue = '\" + b + \"'\"; })(entreeValue,drinkValue);" + "(function(a,b) { return \"entreeValue = '\" + a + \"', drinkValue = '\" + b + \"'\"; })(entreeValue,drinkValue);" ], "solutions": [ "var testObj = {\n \"an entree\": \"hamburger\",\n \"my side\": \"veggies\",\n \"the drink\": \"water\"\n};\nvar entreeValue = testObj[\"an entree\"];\nvar drinkValue = testObj['the drink'];" From 1bfc1f311b5e13ecc41d2b1fc97929d2c3d5c22e Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 31 Dec 2015 06:17:28 +0530 Subject: [PATCH 146/174] Fix typo in Accessing Nested Objects in JSON --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c1505e3792..7e33f57101 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3702,7 +3702,7 @@ "description": [ "The properties and sub-properties of JSON objects can be accessed by chaining together the dot or bracket notation.", "Here is a nested JSON Object:", - "
var ourStorage = {
\"desk\": {
\"drawer\": \"stapler\"
},
\"cabinet\": {
\"top drawer\": {
\"folder1\": \"a file\",
\"folder2\": \"secrets\"
},
\"bottom drawer\": \"soda\"
}
}
ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"
ourStoage.desk.drawer; // \"stapler\"
", + "
var ourStorage = {
\"desk\": {
\"drawer\": \"stapler\"
},
\"cabinet\": {
\"top drawer\": {
\"folder1\": \"a file\",
\"folder2\": \"secrets\"
},
\"bottom drawer\": \"soda\"
}
}
ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"
ourStorage.desk.drawer; // \"stapler\"
", "

Instructions

", "Access the myStorage JSON object to retrieve the contents of the glove box. Only use object notation for properties with a space in their name." ], From 39f29b71d94fe3b2d49f0283d783814b7ac87d37 Mon Sep 17 00:00:00 2001 From: Abhisek Pattnaik Date: Thu, 31 Dec 2015 06:32:33 +0530 Subject: [PATCH 147/174] Fix typo in Testing Objects for Properties --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c1505e3792..ed70421623 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3607,7 +3607,7 @@ "description": [ "Sometimes it is useful to check if the property of a given object exists or not. We can use the .hasOwnProperty([propname]) method of objects to determine if that object has the given property name. .hasOwnProperty() returns true or false if the property is found or not.", "Example", - "
var myObj = {
top: \"hat\",
bottom: \"pants\"
};
myObj.hasOwnProperty(\"hat\"); // true
myObj.hasOwnProperty(\"middle\"); // false
", + "
var myObj = {
top: \"hat\",
bottom: \"pants\"
};
myObj.hasOwnProperty(\"top\"); // true
myObj.hasOwnProperty(\"middle\"); // false
", "

Instructions

", "Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return \"Not Found\"." ], From c903fc3b0b8b5fc0236dd77f63a9cf792177de91 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 30 Dec 2015 17:57:15 -0800 Subject: [PATCH 148/174] Change Mini-Bonfires back to Waypoints --- .../basic-javascript.json | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index c1505e3792..a30c9be482 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -805,8 +805,8 @@ "assert(convert(20) === 68, 'message: convert(20) should return a value of 68');", "assert(convert(30) === 86, 'message: convert(30) should return a value of 86');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -1352,8 +1352,8 @@ "assert(/dog/.test(test1) && /big/.test(test1) && /ran/.test(test1) && /quickly/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words.');", "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -1717,8 +1717,8 @@ "assert(hasNumber, 'message: The second elements in each of your sub-arrays must all be numbers');", "assert(count > 4, 'message: You must have at least 5 items in your list');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -2145,8 +2145,8 @@ "assert(queue([2],1) === 2, 'message: queue([2], 1) should return 2');", "queue(myArr, 10); assert(myArr[4] === 10, 'message: After queue(myArr, 10), myArr[4] should be 10');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -2859,8 +2859,8 @@ "assert(golfScore(4, 7) === \"Go Home!\", 'message: golfScore(4, 7) should return \"Go Home!\"');", "assert(golfScore(5, 9) === \"Go Home!\", 'message: golfScore(5, 9) should return \"Go Home!\"');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -3201,8 +3201,8 @@ "assert((function(){ count = 0; cc(10);cc('J');cc('Q');cc('K');var out = cc('A'); if(out === \"-5 Hold\") {return true;} return false; })(), 'message: Cards Sequence 10, J, Q, K, A should return \"-5 Hold\"');", "assert((function(){ count = 0; cc(3);cc(2);cc('A');cc(10);var out = cc('K'); if(out === \"-1 Hold\") {return true;} return false; })(), 'message: Cards Sequence 3, 2, A, 10, K should return \"-1 Hold\"');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -3875,8 +3875,8 @@ "assert(update(1245, \"tracks\", \"Addicted to Love\")[1245][\"tracks\"].length === 1, 'message: After update(1245, \"tracks\", \"Addicted to Love\"), tracks should have a length of 1');", "update(2548, \"tracks\", \"\"); assert(!collection[2548].hasOwnProperty(\"tracks\"), 'message: After update(2548, \"tracks\", \"\"), tracks should not be set');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -4166,8 +4166,8 @@ "assert(rot13(\"SERR YBIR?\") === \"FREE LOVE?\", 'message: rot13(\"SERR YBIR?\") should decode to \"FREE LOVE?\"');", "assert(rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") === \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\", 'message: rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") should decode to \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\"');" ], - "type": "bonfire", - "challengeType": "5", + "type": "waypoint", + "challengeType": "1", "nameCn": "", "nameFr": "", "nameRu": "", @@ -5141,4 +5141,4 @@ "isBeta": "true" } ] -} \ No newline at end of file +} From 51cd63f7d0eadd418f6238fa236ac7252f4254ff Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 30 Dec 2015 18:56:56 -0800 Subject: [PATCH 149/174] Improve Word Blanks Descriptive Text --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 3e5bcf7a68..0df1e5daa6 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1320,10 +1320,10 @@ "id": "56533eb9ac21ba0edf2244bb", "title": "Word Blanks", "description": [ - "We will now use our knowledge of strings to build a \"Mad Libs\" style word game we're calling \"Word Blanks\". We have provided a framework for testing your results with different words.", - "You will need to use string operators to build a new string, result, using the provided variables: ", - "myNoun, myAdjective, myVerb, and myAdverb.", - "The tests will run your function with several different inputs to make sure it works properly." + "We will now use our knowledge of strings to build a \"Mad Libs\" style word game we're calling \"Word Blanks\". You will create an (optionally humorous) \"Fill in the Blanks\" style sentence. ", + "You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb. ", + "You will also need to provide additional strings, which will not change, in between the provided words.", + "We have provided a framework for testing your results with different words. The tests will run your function with several different inputs to make sure all of the provided words appear in the output, as well as your extra strings." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -5141,4 +5141,4 @@ "isBeta": "true" } ] -} +} \ No newline at end of file From 0d66d04b54fed8a1ec17b1109b53d19b67526da9 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 30 Dec 2015 19:33:00 -0800 Subject: [PATCH 150/174] Update Case Sensitivity Description --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index e0f927db84..d4c2593ee0 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -229,7 +229,7 @@ "Examples:", "
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", "

Instructions

", - "Correct the variable assignments so their names match their variable declarations above." + "We have provided some decidedly non-standard case variable declarations. Update the variable assignments so their names match the case of their declarations above." ], "releasedOn": "January 1, 2016", "challengeSeed": [ @@ -5141,4 +5141,4 @@ "isBeta": "true" } ] -} +} \ No newline at end of file From f28d7e0485983125acd1fa28c6c17a9651611b62 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 30 Dec 2015 19:54:18 -0800 Subject: [PATCH 151/174] Improve Logical Or description --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 109dccfbfe..fe0318e0ac 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2629,7 +2629,7 @@ "will return \"Yes\" only if num is between 5 and 10 (5 and 10 included). The same logic can be written as:", "
if (num > 10 || num < 5) {
return \"No\";
}
return \"Yes\";
", "

Instructions

", - "Combine the two if statements into one statement which returns \"Inside\" if val is between 10 and 20, inclusive. Otherwise, return \"Outside\"." + "Combine the two if statements into one statement which returns \"Outside\" if val is not between 10 and 20, inclusive. Otherwise, return \"Inside\"." ], "releasedOn": "January 1, 2016", "challengeSeed": [ From 413e24f83af76bc2275f1b788d6e2a36fed04a91 Mon Sep 17 00:00:00 2001 From: Eric Leung Date: Wed, 30 Dec 2015 21:20:30 -0800 Subject: [PATCH 152/174] Fix vague variable names in Celsius to Fahrenheit --- .../basic-javascript.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index fe0318e0ac..21b88ea249 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -775,19 +775,19 @@ "description": [ "To test your learning you will create a solution \"from scratch\". Place your code between the indicated lines and it will be tested against multiple test cases.", "The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.", - "You are given a variable Tc representing a temperature in Celsius. Create a variable Tf and apply the algorithm to assign it the corresponding temperature in Fahrenheit." + "You are given a variable celsius representing a temperature in Celsius. Create a variable fahrenheit and apply the algorithm to assign it the corresponding temperature in Fahrenheit." ], "releasedOn": "January 1, 2016", "challengeSeed": [ - "function convert(Tc) {", + "function convert(celsius) {", " // Only change code below this line", " ", "", " // Only change code above this line", - " if(typeof Tf !== 'undefined') {", - " return Tf;", + " if ( typeof fahrenheit !== 'undefined' ) {", + " return fahrenheit;", " } else {", - " return \"Tf not defined\";", + " return 'fahrenheit not defined';", " }", "}", "", @@ -795,7 +795,7 @@ "convert(30);" ], "solutions": [ - "function convert(Tc) {\n var Tf = Tc * 9/5 + 32;\n if(typeof Tf !== 'undefined') {\n return Tf;\n } else {\n return \"Tf not defined\";\n }\n}" + "function convert(celsius) {\n var fahrenheit = celsius * 9/5 + 32;\n if ( typeof fahrenheit !== 'undefined' ) {\n return fahrenheit;\n } else {\n return 'fahrenheit not defined';\n }\n}" ], "tests": [ "assert(typeof convert(0) === 'number', 'message: convert(0) should return a number');", @@ -5141,4 +5141,4 @@ "isBeta": "true" } ] -} \ No newline at end of file +} From 0c0510e97d779f9a81bcc4b9f9d879a1c285cff0 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 30 Dec 2015 20:52:54 -0800 Subject: [PATCH 153/174] Improve Concatenation Strings Descriptions --- .../basic-javascript.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index fe0318e0ac..8899ff2f41 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -951,6 +951,7 @@ "In JavaScript, when the + operator is used with a String value, it is called the concatenation operator. You can build a new string out of other strings by concatenating them together.", "Example", "
'My name is Alan,' + ' I concatenate.'
", + "Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.", "

Instructions

", "Build myStr from the strings \"This is the start. \" and \"This is the end.\" using the + operator." ], @@ -985,6 +986,7 @@ "title": "Concatenating Strings with the Plus Equals Operator", "description": [ "We can also use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.", + "Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.", "

Instructions

", "Build myStr over several lines by concatenating these two strings:
\"This is the first sentence. \" and \"This is the second sentence.\" using the += operator." ], From 139e43fd109499f04aa64ff3e2c0cd8e3aa00013 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Wed, 30 Dec 2015 22:13:20 -0800 Subject: [PATCH 154/174] Allow Single Quotes in Construct Strings --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 21b88ea249..760089b61b 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1040,7 +1040,7 @@ ], "tests": [ "assert(typeof myName !== 'undefined' && myName.length > 2, 'message: myName should be set to a string at least 3 characters long');", - "assert(code.match(/\"\\s*\\+\\s*myName\\s*\\+\\s*\"/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" + "assert(code.match(/[\"']\\s*\\+\\s*myName\\s*\\+\\s*[\"']/g).length > 0, 'message: Use two + operators to build myStr with myName inside it');" ], "type": "waypoint", "challengeType": "1", @@ -5141,4 +5141,4 @@ "isBeta": "true" } ] -} +} \ No newline at end of file From 7d805c54b74a3e21648caf3ab2b8b25276c82758 Mon Sep 17 00:00:00 2001 From: augmt Date: Thu, 31 Dec 2015 02:00:54 -0500 Subject: [PATCH 155/174] Display correct assertion in Basic JS Waypoint 85 --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 41283227be..dcf7274e6f 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3639,7 +3639,7 @@ ], "tests": [ "assert(checkObj(\"gift\") === \"pony\", 'message: checkObj(\"gift\") should return \"pony\".');", - "assert(checkObj(\"pet\") === \"kitten\", 'message: checkObj(\"gift\") should return \"kitten\".');", + "assert(checkObj(\"pet\") === \"kitten\", 'message: checkObj(\"pet\") should return \"kitten\".');", "assert(checkObj(\"house\") === \"Not Found\", 'message: checkObj(\"house\") should return \"Not Found\".');" ], "type": "waypoint", @@ -5143,4 +5143,4 @@ "isBeta": "true" } ] -} \ No newline at end of file +} From 02ef4ea9133590236dc641ce1b98e2d1d21b0724 Mon Sep 17 00:00:00 2001 From: Dieter Daems Date: Thu, 31 Dec 2015 14:17:07 +0100 Subject: [PATCH 156/174] Fix stack trace error in javascript challenge - added a additional check to make sure the function exists --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index dcf7274e6f..195b23e42b 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1841,8 +1841,8 @@ ], "tests": [ "assert(typeof myFunction === 'function', 'message: myFunction should be a function');", - "capture(); myFunction(1,2); uncapture(); assert(logOutput == 3, 'message: myFunction(1,2) should output 3');", - "capture(); myFunction(7,9); uncapture(); assert(logOutput == 16, 'message: myFunction(7,9) should output 16');", + "if(typeof myFunction === \"function\") { capture(); myFunction(1,2); uncapture(); } assert(logOutput == 3, 'message: myFunction(1,2) should output 3');", + "if(typeof myFunction === \"function\") { capture(); myFunction(7,9); uncapture(); } assert(logOutput == 16, 'message: myFunction(7,9) should output 16');", "assert(/^\\s*myFunction\\(\\s*\\d+\\s*,\\s*\\d+\\s*\\)\\s*;/m.test(code), 'message: Call myFunction after you define it');" ], "type": "waypoint", From d67ec6042255bbee6464f690b8ffb03f295b003f Mon Sep 17 00:00:00 2001 From: Raja Gopal M Date: Thu, 31 Dec 2015 19:30:13 +0530 Subject: [PATCH 157/174] Fix #5634 - bugs in return string and test cases in 'Else If' waypoint Updated the .json file to have correct return string in the seed of 'Waypoint Challenge: Introduction to Else If Statements' As well, corrected test case bugs in this commit --- .../basic-javascript.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index dcf7274e6f..11a0a46651 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2740,7 +2740,7 @@ "challengeSeed": [ "function myTest(val) {", " if(val > 10) {", - " return \"10 or Bigger\";", + " return \"Greater than 10\";", " }", " ", " if(val < 5) {", @@ -2755,16 +2755,16 @@ "" ], "solutions": [ - "function myTest(val) {\n if(val > 10) {\n return \"10 or Bigger\";\n } else if(val < 5) {\n return \"Smaller than 5\";\n } else {\n return \"Between 5 and 10\";\n }\n}" + "function myTest(val) {\n if(val > 10) {\n return \"Greater than 10\";\n } else if(val < 5) {\n return \"Smaller than 5\";\n } else {\n return \"Between 5 and 10\";\n }\n}" ], "tests": [ "assert(code.match(/else/g).length > 1, 'message: You should have at least two else statements');", "assert(code.match(/if/g).length > 1, 'message: You should have at least two if statements');", - "assert(myTest(0) === \"Smaller than 5\", 'message: myTest(4) should return \"Smaller than 5\"');", - "assert(myTest(5) === \"Between 5 and 10\", 'message: myTest(5) should return \"Smaller than 5\"');", + "assert(myTest(0) === \"Smaller than 5\", 'message: myTest(0) should return \"Smaller than 5\"');", + "assert(myTest(5) === \"Between 5 and 10\", 'message: myTest(5) should return \"Between 5 and 10\"');", "assert(myTest(7) === \"Between 5 and 10\", 'message: myTest(7) should return \"Between 5 and 10\"');", "assert(myTest(10) === \"Between 5 and 10\", 'message: myTest(10) should return \"Between 5 and 10\"');", - "assert(myTest(12) === \"10 or Bigger\", 'message: myTest(12) should return \"10 or Bigger\"');" + "assert(myTest(12) === \"Greater than 10\", 'message: myTest(12) should return \"Greater than 10\"');" ], "type": "waypoint", "challengeType": "1", From a9b694a9273c63d03ef9c47e2baad2eef23d13b2 Mon Sep 17 00:00:00 2001 From: Robert Richey Date: Thu, 31 Dec 2015 07:37:58 -0700 Subject: [PATCH 158/174] Fix test on Waypoint: Concatenating Strings with Plus Operator Second test case now allows for either single or double quotes. Test uses verbose regex to help eliminate edge cases. closes #5583 --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 3e5bcf7a68..34617875a3 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -970,7 +970,7 @@ ], "tests": [ "assert(myStr === \"This is the start. This is the end.\", 'message: myStr should have a value of This is the start. This is the end.');", - "assert(code.match(/\"\\s*\\+\\s*\"/g).length > 1, 'message: Use the + operator to build myStr');" + "assert(code.match(/This is the start\\.\\s*[\"']\\s*(.)\\s*[\"']This is the end\\.[\"'];\\s*$/)[1] === \"+\", 'message: Use the + operator to build myStr');" ], "type": "waypoint", "challengeType": "1", From 9b0673ea1efd4983530a1e1b64ca687fc6be2915 Mon Sep 17 00:00:00 2001 From: Robert Richey Date: Thu, 31 Dec 2015 09:01:40 -0700 Subject: [PATCH 159/174] Fix tests on Waypoint: Using typeof Tests are now more robust. typeof string accepts any string - empty or not - with either single or double quotes. typeof number accepts any number, including floating point. Refactored from editor.getValue().match to code.match() and removed flags gi, as they don't make sense in these tests. closes #5065 --- .../automated-testing-and-debugging.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json b/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json index 51ed503328..90e38c5139 100644 --- a/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json +++ b/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json @@ -53,10 +53,10 @@ "console.log(typeof {});" ], "tests":[ - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]\"\"\\)?\\);/gi), 'message: You should console.log the typeof a string.');", - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]0\\)?\\);/gi), 'message: You should console.log the typeof a number.');", - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]\\[\\]\\)?\\);/gi), 'message: You should console.log the typeof an array.');", - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]\\{\\}\\)?\\);/gi), 'message: You should console.log the typeof a object.');" + "assert(code.match(/console\\.log\\(typeof[\\( ][\"'].*[\"']\\)?\\);/), 'message: You should console.log the typeof a string.');", + "assert(code.match(/console\\.log\\(typeof[\\( ]\\d+\\.?\\d*\\)?\\);/), 'message: You should console.log the typeof a number.');", + "assert(code.match(/console\\.log\\(typeof[\\( ]\\[\\]\\)?\\);/), 'message: You should console.log the typeof an array.');", + "assert(code.match(/console\\.log\\(typeof[\\( ]\\{\\}\\)?\\);/), 'message: You should console.log the typeof a object.');" ], "challengeSeed":[ "", From 8cbc23b2255992550d22b1158a67a23eae6b4a37 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 31 Dec 2015 10:53:00 -0800 Subject: [PATCH 160/174] Improve Case Sensitivity Waypoint --- .../basic-javascript.json | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index dcf7274e6f..026128fc4a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -224,34 +224,32 @@ "description": [ "In JavaScript all variables and function names are case sensitive. This means that capitalization matters.", "MYVAR is not the same as MyVar nor myvar. It is possible to have multiple distinct variables with the same name but different casing. It is strongly recommended that for the sake of clarity, you do not use this language feature.", - "

Best Practice

Write variable names in Javascript in camelCase. In camelCase, variable names made of multiple words have the first word in all lowercase and the first letter of each subsequent word(s) capitalized.
", - " ", + "

Best Practice

", + "Write variable names in Javascript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.", "Examples:", "
var someVariable;
var anotherVariableName;
var thisVariableNameIsTooLong;
", "

Instructions

", - "We have provided some decidedly non-standard case variable declarations. Update the variable assignments so their names match the case of their declarations above." + "Fix the variable declarations and assignments so their names use camelCase." ], "releasedOn": "January 1, 2016", "challengeSeed": [ - "// Setup", + "// Declarations", "var StUdLyCapVaR;", "var properCamelCase;", "var TitleCaseOver;", "", - "// Only change code below this line", - "", + "// Assignments", "STUDLYCAPVAR = 10;", "PRoperCAmelCAse = \"A String\";", - "tITLEcASEoVER = 9000;", - "" + "tITLEcASEoVER = 9000;" ], "solutions": [ - "var StUdLyCapVaR;\nvar properCamelCase;\nvar TitleCaseOver;\n\nStUdLyCapVaR = 10;\nproperCamelCase = \"A String\";\nTitleCaseOver = 9000;" + "var studlyCapVar;\nvar properCamelCase;\nvar titleCaseOver;\n\nstudlyCapVar = 10;\nproperCamelCase = \"A String\";\ntitleCaseOver = 9000;" ], "tests": [ - "assert(StUdLyCapVaR === 10, 'message: StUdLyCapVaR has the correct case');", - "assert(properCamelCase === \"A String\", 'message: properCamelCase has the correct case');", - "assert(TitleCaseOver === 9000, 'message: TitleCaseOver has the correct case');" + "assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10, 'message: studlyCapVar is defined and has a value of 10');", + "assert(typeof properCamelCase !== 'undefined' && properCamelCase === \"A String\", 'message: properCamelCase is defined and has a value of \"A String\"');", + "assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000, 'message: titleCaseOver is defined and has a value of 9000');" ], "type": "waypoint", "challengeType": "1", @@ -5143,4 +5141,4 @@ "isBeta": "true" } ] -} +} \ No newline at end of file From 9f8a5a07e483f3eada932922d27b9aab1db4b64d Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 31 Dec 2015 13:41:03 -0800 Subject: [PATCH 161/174] Add Tail or Display Functions where missing --- .../basic-javascript.json | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7b1cf7f0ca..125152cc1a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -862,6 +862,15 @@ "", "" ], + "tail": [ + "(function(){", + " if(typeof myStr === 'string') {", + " return \"myStr = \" + myStr;", + " } else {", + " return \"myStr is undefined\";", + " }", + "})();" + ], "solutions": [ "var myStr = \"I am a \\\"double quoted\\\" string inside \\\"double quotes\\\"\";" ], @@ -964,6 +973,15 @@ "", "" ], + "tail": [ + "(function(){", + " if(typeof myStr === 'string') {", + " return 'myStr = \"' + myStr + '\"';", + " } else {", + " return 'myStr is not a string';", + " }", + "})();" + ], "solutions": [ "var ourStr = \"I come first. \" + \"I come second.\";\nvar myStr = \"This is the start. \" + \"This is the end.\";" ], @@ -1000,6 +1018,15 @@ "", "" ], + "tail": [ + "(function(){", + " if(typeof myStr === 'string') {", + " return 'myStr = \"' + myStr + '\"';", + " } else {", + " return 'myStr is not a string';", + " }", + "})();" + ], "solutions": [ "var ourStr = \"I come first. \";\nourStr += \"I come second.\";\n\nvar myStr = \"This is the first sentence. \";\nmyStr += \"This is the second sentence.\";" ], @@ -1035,6 +1062,22 @@ "", "" ], + "tail": [ + "(function(){", + " var output = [];", + " if(typeof myName === 'string') {", + " output.push('myName = \"' + myName + '\"');", + " } else {", + " output.push('myName is not a string');", + " }", + " if(typeof myStr === 'string') {", + " output.push('myStr = \"' + myStr + '\"');", + " } else {", + " output.push('myStr is not a string');", + " }", + " return output.join('\\n');", + "})();" + ], "solutions": [ "var myName = \"Bob\";\nvar myStr = \"My name is \" + myName + \" and I am swell!\";" ], @@ -1071,6 +1114,22 @@ "var myStr = \"Learning to code is \";", "" ], + "tail": [ + "(function(){", + " var output = [];", + " if(typeof someAdjective === 'string') {", + " output.push('someAdjective = \"' + someAdjective + '\"');", + " } else {", + " output.push('someAdjective is not a string');", + " }", + " if(typeof myStr === 'string') {", + " output.push('myStr = \"' + myStr + '\"');", + " } else {", + " output.push('myStr is not a string');", + " }", + " return output.join('\\n');", + "})();" + ], "solutions": [ "var anAdjective = \"awesome!\";\nvar ourStr = \"Free Code Camp is \";\nourStr += anAdjective;\n\nvar someAdjective = \"neat\";\nvar myStr = \"Learning to code is \";\nmyStr += someAdjective;" ], @@ -3578,7 +3637,9 @@ " // Only change code above this line", " return result;", "}", - "" + "", + "// Change this value to test", + "phoneticLookup(\"charlie\");" ], "solutions": [ "function phoneticLookup(val) {\n var result = \"\";\n\n var lookup = {\n alpha: \"Adams\",\n bravo: \"Boston\",\n charlie: \"Chicago\",\n delta: \"Denver\",\n echo: \"Easy\",\n foxtrot: \"Frank\"\n };\n\n result = lookup[val];\n\n return result;\n}" From d533e027a9406054e694d76c4807570ff0cf9924 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Thu, 31 Dec 2015 16:11:10 -0600 Subject: [PATCH 162/174] add hackclub --- server/utils/commit.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/utils/commit.json b/server/utils/commit.json index 8a9aed8126..b37b819c6f 100644 --- a/server/utils/commit.json +++ b/server/utils/commit.json @@ -38,5 +38,13 @@ "description": "Girls Who Code programs work to inspire, educate, and equip girls with the computing skills to pursue 21st century opportunities.", "imgAlt": "Three women smiling while they code on a computer together.", "imgUrl": "http://i.imgur.com/op8BVph.jpg" + }, + { + "name": "hack club", + "displayName": "Hack Club", + "donateUrl": "https://hackclub.io/", + "description": "Hack Club works with high school students to start and lead programming clubs at their schools.", + "imgAlt": "A bunch of high school students posing for a photo in their programming club.", + "imgUrl": "http://i.imgur.com/G2YvPHf.jpg" } ] \ No newline at end of file From 92df9f8d5f4fd11dce1ec32b9572c19678c55963 Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Thu, 31 Dec 2015 14:39:19 -0800 Subject: [PATCH 163/174] fix typo in chaining if/else statements Waypoint --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7b1cf7f0ca..8d806cc3a3 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2777,7 +2777,7 @@ "title": "Chaining If Else Statements", "description": [ "if/else statements can be chained together for complex logic. Here is pseudocode of multiple chained if / else if statements:", - "
if(condition1) {
statement1
} else if (condition1) {
statement1
} else if (condition3) {
statement3
. . .
} else {
statementN
}
", + "
if(condition1) {
statement1
} else if (condition2) {
statement2
} else if (condition3) {
statement3
. . .
} else {
statementN
}
", "

Instructions

", "Write chained if/else if statements to fulfill the following conditions:", "num < 5 - return \"Tiny\"
num < 10 - return \"Small\"
num < 15 - return \"Medium\"
num < 20 - return \"Large\"
num >= 20 - return \"Huge\"" @@ -5141,4 +5141,4 @@ "isBeta": "true" } ] -} \ No newline at end of file +} From 63f324c147a08ccfbc69e5f8b5647dfcaecfcd65 Mon Sep 17 00:00:00 2001 From: Raja Gopal M Date: Fri, 1 Jan 2016 04:42:07 +0530 Subject: [PATCH 164/174] Fix #5628 - Update test case to fix logic around return statements Fixed test case to allow 5 or more 'return' statements to be used in 'Waypoint: Chaining If Else Statements' --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7b1cf7f0ca..b59ee1e63d 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2801,7 +2801,7 @@ "tests": [ "assert(code.match(/else/g).length > 3, 'message: You should have at least four else statements');", "assert(code.match(/if/g).length > 3, 'message: You should have at least four if statements');", - "assert(code.match(/return/g).length === 5, 'message: You should have five return statements');", + "assert(code.match(/return/g).length >= 5, 'message: You should have at least five return statements');", "assert(myTest(0) === \"Tiny\", 'message: myTest(0) should return \"Tiny\"');", "assert(myTest(4) === \"Tiny\", 'message: myTest(4) should return \"Tiny\"');", "assert(myTest(5) === \"Small\", 'message: myTest(5) should return \"Small\"');", From e00a42617c7db63e6912a263022c8514bdc3f2f0 Mon Sep 17 00:00:00 2001 From: wilstenholme Date: Thu, 31 Dec 2015 18:29:00 -0500 Subject: [PATCH 165/174] Fix typos and clarify the description --- .../basic-javascript.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0565caa7ea..6093546c73 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2157,8 +2157,8 @@ "id": "cf1111c1c12feddfaeb3bdef", "title": "Use Conditional Logic with If Statements", "description": [ - "We can use if statements in JavaScript to only execute code if a certain condition is met.", - "if statements require a boolean condition to evaluate. If the boolean evaluates to true, the statement inside the curly braces executes. If it evaluates to false, the code will not execute.", + "We can use if statements in JavaScript to execute code only if the specified condition is met.", + "Each if statement requires a boolean condition to evaluate. If the boolean evaluates to true, the statements inside the curly braces will execute. Otherwise, if it evaluates to false, the code will not execute.", "Example", "
function test(myVal) {
if (myVal > 10) {
return \"Greater Than\";
}
return \"Not Greater Than\";
}
", "If myVal is greater than 10, the function will return \"Greater Than\". If it is not, the function will return \"Not Greater Than\".", From 9f2ad1cf256a98c97bb57f70edde5dcbfed0d74e Mon Sep 17 00:00:00 2001 From: Peter Benjamin Date: Thu, 31 Dec 2015 16:03:10 -0800 Subject: [PATCH 166/174] Fix Plus-Equals Concatenation Waypoint --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0565caa7ea..983d3d346a 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1005,7 +1005,7 @@ ], "tests": [ "assert(myStr === \"This is the first sentence. This is the second sentence.\", 'message: myStr should have a value of This is the first sentence. This is the second sentence.');", - "assert(code.match(/\\w\\s*\\+=\\s*\"/g).length > 1 && code.match(/\\w\\s*\\=\\s*\"/g).length > 1, 'message: Use the += operator to build myStr');" + "assert(code.match(/\\w\\s*\\+=\\s*[\"']/g).length > 1 && code.match(/\\w\\s*\\=\\s*[\"']/g).length > 1, 'message: Use the += operator to build myStr');" ], "type": "waypoint", "challengeType": "1", From ee17d9f4222a89f30d04b937f123f9b9a3452eb7 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 31 Dec 2015 18:28:11 -0800 Subject: [PATCH 167/174] Fix typo in Returning Boolean Values from Functions --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0db65f917d..a54e5832c9 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3105,7 +3105,7 @@ ], "tests": [ "assert(isLess(10,15) === true, 'message: isLess(10,15) should return true');", - "assert(isLess(15, 10) === false, 'message: isLess(15,10) should return true');", + "assert(isLess(15, 10) === false, 'message: isLess(15,10) should return false');", "assert(!/if|else/g.test(code), 'message: You should not use any if or else statements');" ], "type": "waypoint", From 2367c5be7a1fee9d6ec5891019f110c0f939ddab Mon Sep 17 00:00:00 2001 From: Brandon Eichler Date: Thu, 31 Dec 2015 20:41:16 -0600 Subject: [PATCH 168/174] Rephrase instructions on Waypoint: Stand in Line Instructions were unclear as to what the function should return. fixes #5655 --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 0db65f917d..2125059116 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -2098,7 +2098,7 @@ "title": "Stand in Line", "description": [ "In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.", - "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove and return the first element of the array." + "Write a function queue which takes an \"array\" and an \"item\" as arguments. Add the item onto the end of the array, then remove the first element of the array. The queue function should return the element that was removed." ], "releasedOn": "January 1, 2016", "head": [ From 216b4ba4f5d73520a94d5cf06b84669d22f589d4 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 31 Dec 2015 18:55:11 -0800 Subject: [PATCH 169/174] Fix typo in Subtraction Waypoint --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index ee385d8b7c..a8d6fef034 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -298,7 +298,7 @@ "JavaScript uses the - symbol for subtraction.", "", "Example", - "
myVAr = 12 - 6; // assigned 6
", + "
myVar = 12 - 6; // assigned 6
", "", "

Instructions

", "Change the 0 so the difference is 12." From 785812318ee2cc6d1c62edf566c50c49299b30ff Mon Sep 17 00:00:00 2001 From: Akira Laine Date: Fri, 1 Jan 2016 14:13:36 +1100 Subject: [PATCH 170/174] fixed "break" statement test --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index ee385d8b7c..642cade5fd 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3113,7 +3113,7 @@ "tests": [ "assert(!/else/g.test(code), 'message: You should not use any else statements');", "assert(!/if/g.test(code), 'message: You should not use any if statements');", - "assert(code.match(/break/g).length === 4, 'message: You should have four break statements');", + "assert(code.match(/break/g).length >= 4, 'message: You should have at least four break statements');", "assert(myTest(\"bob\") === \"Marley\", 'message: myTest(\"bob\") should be \"Marley\"');", "assert(myTest(42) === \"The Answer\", 'message: myTest(42) should be \"The Answer\"');", "assert(myTest(1) === \"There is no #1\", 'message: myTest(1) should be \"There is no #1\"');", From b3c95e9775177c8f192eebfe4db2c749b73e2a6f Mon Sep 17 00:00:00 2001 From: Logan Tegman Date: Thu, 31 Dec 2015 13:42:03 -0800 Subject: [PATCH 171/174] Remove Confusing Word-Blank Test --- .../basic-javascript.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 7b1cf7f0ca..abcc5af237 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1347,10 +1347,9 @@ "function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {\n var result = \"\";\n\n result = \"Once there was a \" + myNoun + \" which was very \" + myAdjective + \". \";\n result += \"It \" + myVerb + \" \" + myAdverb + \" around the yard.\";\n\n return result;\n}" ], "tests": [ - "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string');", - "assert(wordBlanks(\"\",\"\",\"\",\"\").length > 30, 'message: wordBlanks(\"\",\"\",\"\",\"\") should return at least 30 characters with empty inputs');", - "assert(/dog/.test(test1) && /big/.test(test1) && /ran/.test(test1) && /quickly/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words.');", - "assert(/cat/.test(test2) && /little/.test(test2) && /hit/.test(test2) && /slowly/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words.');" + "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: wordBlanks(\"\",\"\",\"\",\"\") should return a string.');", + "assert(/\\bdog\\b/.test(test1) && /\\bbig\\b/.test(test1) && /\\bran\\b/.test(test1) && /\\bquickly\\b/.test(test1),'message: wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).');", + "assert(/\\bcat\\b/.test(test2) && /\\blittle\\b/.test(test2) && /\\bhit\\b/.test(test2) && /\\bslowly\\b/.test(test2),'message: wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\") should contain all of the passed words separated by non-word characters (and any additional words in your madlib).');" ], "type": "waypoint", "challengeType": "1", @@ -5141,4 +5140,4 @@ "isBeta": "true" } ] -} \ No newline at end of file +} From 81ea44473a1763d6fad8d8d0b9df0021f6b17a4d Mon Sep 17 00:00:00 2001 From: Brandon Eichler Date: Thu, 31 Dec 2015 23:40:38 -0600 Subject: [PATCH 172/174] Fixes #5688 random space in challengeSeed of Storing Values with Equal Operator In the challengeSeed of Storing Values with the Equal Operator, there was a random space input after the line "// Only change code below this line" --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index e839164cec..6c54ec4dc6 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -117,7 +117,7 @@ "var b = 2;", "", "// Only change code below this line", - " " + "" ], "tail": [ "(function(a,b){return \"a = \" + a + \", b = \" + b;})(a,b);" From 592b14b0bc7972dfc800f9c4db0ffdf1d2c957f5 Mon Sep 17 00:00:00 2001 From: SaintPeter Date: Thu, 31 Dec 2015 22:10:38 -0800 Subject: [PATCH 173/174] Fix spelling of Dictionary --- .../basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index d3e05bb9cc..356c5c7ae4 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -3600,7 +3600,7 @@ "id": "56533eb9ac21ba0edf2244ca", "title": "Using Objects for Lookups", "description": [ - "Objects can be thought of as a key/value storage, like a dictonary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.", + "Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to \"lookup\" values rather than a switch statement or an if/else chain. This is most useful when you know that your input data is limited to a certain range.", "Here is an example of a simple reverse alphabet lookup:", "
var alpha = {
1:\"Z\",
2:\"Y\",
3:\"X\",
4:\"W\",
...
24:\"C\",
25:\"B\",
26:\"A\"
};
alpha[2]; // \"Y\"
alpha[24]; // \"C\"
", "

Instructions

", From 035b6027debfc6eb59287329f818f17e391da374 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Fri, 1 Jan 2016 00:34:05 -0600 Subject: [PATCH 174/174] make challenges new and extend to 60 days --- .../data-visualization-projects.json | 15 ++++++++++----- .../react-projects.json | 15 ++++++++++----- .../api-projects.json | 15 ++++++++++----- server/boot/challenge.js | 2 +- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json index 45efa1afae..687a939099 100644 --- a/seed/challenges/02-data-visualization-certification/data-visualization-projects.json +++ b/seed/challenges/02-data-visualization-certification/data-visualization-projects.json @@ -33,7 +33,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7178d8c242eddfaeb5bd13", @@ -65,7 +66,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7188d8c242eddfaeb5bd13", @@ -98,7 +100,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7198d8c242eddfaeb5bd13", @@ -133,7 +136,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7108d8c242eddfaeb5bd13", @@ -166,7 +170,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" } ] } \ No newline at end of file diff --git a/seed/challenges/02-data-visualization-certification/react-projects.json b/seed/challenges/02-data-visualization-certification/react-projects.json index 460edcd382..503f06e51e 100644 --- a/seed/challenges/02-data-visualization-certification/react-projects.json +++ b/seed/challenges/02-data-visualization-certification/react-projects.json @@ -33,7 +33,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7156d8c242eddfaeb5bd13", @@ -67,7 +68,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7155d8c242eddfaeb5bd13", @@ -102,7 +104,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7154d8c242eddfaeb5bd13", @@ -139,7 +142,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7153d8c242eddfaeb5bd13", @@ -177,7 +181,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" } ] } \ No newline at end of file diff --git a/seed/challenges/03-back-end-development-certification/api-projects.json b/seed/challenges/03-back-end-development-certification/api-projects.json index d8b5b281dc..9dc9b297a5 100644 --- a/seed/challenges/03-back-end-development-certification/api-projects.json +++ b/seed/challenges/03-back-end-development-certification/api-projects.json @@ -220,7 +220,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7158d8c443edefaeb5bdff", @@ -248,7 +249,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7158d8c443edefaeb5bd0e", @@ -278,7 +280,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7158d8c443edefaeb5bdee", @@ -308,7 +311,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" }, { "id": "bd7158d8c443edefaeb5bd0f", @@ -338,7 +342,8 @@ "nameEs": "", "descriptionEs": [], "namePt": "", - "descriptionPt": [] + "descriptionPt": [], + "releasedOn": "January 1, 2016" } ] } \ No newline at end of file diff --git a/server/boot/challenge.js b/server/boot/challenge.js index 4fdb8109de..f23a41c2be 100644 --- a/server/boot/challenge.js +++ b/server/boot/challenge.js @@ -90,7 +90,7 @@ const dateFormat = 'MMM MMMM DD, YYYY'; function shouldShowNew(element, block) { if (element) { return typeof element.releasedOn !== 'undefined' && - moment(element.releasedOn, dateFormat).diff(moment(), 'days') >= -30; + moment(element.releasedOn, dateFormat).diff(moment(), 'days') >= -60; } if (block) {