Merge pull request #9249 from FreeCodeCamp/staging

Release staging
This commit is contained in:
Berkeley Martinez
2016-06-20 11:36:46 -07:00
committed by GitHub
19 changed files with 207 additions and 246 deletions

View File

@ -7,7 +7,7 @@
Welcome to Free Code Camp's open source codebase and curriculum! Welcome to Free Code Camp's open source codebase and curriculum!
======================= =======================
Free Code Camp is a friendly open-source community where you learn to code and help nonprofits. Free Code Camp is a friendly open source community where you learn to code and help nonprofits.
**We help our campers build job-worthy portfolios of real apps used by real people, while helping nonprofits.** **We help our campers build job-worthy portfolios of real apps used by real people, while helping nonprofits.**

View File

@ -2,6 +2,7 @@ window.common = (function({ $, common = { init: [] }}) {
common.displayTestResults = function displayTestResults(data = []) { common.displayTestResults = function displayTestResults(data = []) {
$('#testSuite').children().remove(); $('#testSuite').children().remove();
$('#testSuite').fadeIn('slow');
data.forEach(({ err = false, text = '' }) => { data.forEach(({ err = false, text = '' }) => {
var iconClass = err ? var iconClass = err ?
'"ion-close-circled big-error-icon"' : '"ion-close-circled big-error-icon"' :
@ -20,7 +21,7 @@ window.common = (function({ $, common = { init: [] }}) {
`) `)
.appendTo($('#testSuite')); .appendTo($('#testSuite'));
}); });
$('#scroll-locker').animate({ scrollTop: $(document).height() }, 'slow');
return data; return data;
}; };

View File

@ -89,6 +89,7 @@ $(document).ready(function() {
common.submitBtn$ common.submitBtn$
) )
.flatMap(() => { .flatMap(() => {
$('#testSuite').fadeOut('slow');
common.appendToOutputDisplay('\n// testing challenge...'); common.appendToOutputDisplay('\n// testing challenge...');
return common.executeChallenge$() return common.executeChallenge$()
.map(({ tests, ...rest }) => { .map(({ tests, ...rest }) => {

View File

@ -4,20 +4,6 @@ module.exports = {
sessionSecret: process.env.SESSION_SECRET, sessionSecret: process.env.SESSION_SECRET,
trello: {
key: process.env.TRELLO_KEY,
secret: process.env.TRELLO_SECRET
},
blogger: {
key: process.env.BLOGGER_KEY
},
mandrill: {
user: process.env.MANDRILL_USER,
password: process.env.MANDRILL_PASSWORD
},
facebook: { facebook: {
clientID: process.env.FACEBOOK_ID, clientID: process.env.FACEBOOK_ID,
clientSecret: process.env.FACEBOOK_SECRET, clientSecret: process.env.FACEBOOK_SECRET,

View File

@ -7,16 +7,6 @@ var _ = require('lodash');
var instances = process.env.INSTANCES || 1; var instances = process.env.INSTANCES || 1;
var serverName = process.env.SERVER_NAME || 'server'; var serverName = process.env.SERVER_NAME || 'server';
var maxMemory = process.env.MAX_MEMORY || '390M'; var maxMemory = process.env.MAX_MEMORY || '390M';
var transportOptions = {
type: 'smtp',
service: 'Mandrill',
auth: {
user: process.env.MANDRILL_USER || false,
pass: process.env.MANDRILL_PASSWORD
}
};
var mailReceiver = process.env.MAIL_RECEIVER || false;
pm2.connect(function() { pm2.connect(function() {
pm2.start({ pm2.start({
@ -36,46 +26,3 @@ pm2.connect(function() {
pm2.disconnect(); pm2.disconnect();
}); });
}); });
if (transportOptions.auth.user && mailReceiver) {
console.log('setting up mailer');
var transporter = nodemailer.createTransport(transportOptions);
var compiled = _.template(
'An error has occurred on server ' +
'<% name %>\n' +
'Stack Trace:\n\n\n<%= stack %>\n\n\n' +
'Context:\n\n<%= text %>'
);
pm2.launchBus(function(err, bus) {
if (err) {
return console.error(err);
}
console.log('event bus connected');
bus.on('process:exception', function(data) {
var text;
var stack;
var name;
try {
data.date = moment(data.at || new Date())
.tz('America/Los_Angeles')
.format('MMMM Do YYYY, h:mm:ss a z');
text = JSON.stringify(data, null, 2);
stack = data.data.stack;
name = data.process.name;
} catch (e) {
return e;
}
transporter.sendMail({
to: mailReceiver,
from: 'team@freecodecamp.com',
subject: 'Server exception',
text: compiled({ name: name, text: text, stack: stack })
});
});
});
}

View File

@ -12,9 +12,6 @@ GOOGLE_SECRET=stuff
LINKEDIN_ID=stuff LINKEDIN_ID=stuff
LINKEDIN_SECRET=stuff LINKEDIN_SECRET=stuff
MANDRILL_PASSWORD=stuff
MANDRILL_USER=stuff
TWITTER_KEY=stuff TWITTER_KEY=stuff
TWITTER_SECRET=stuff TWITTER_SECRET=stuff
TWITTER_TOKEN=stuff TWITTER_TOKEN=stuff

View File

@ -38,46 +38,46 @@ var links = {
// ========== OBJECT METHODS // ========== OBJECT METHODS
"Object.getOwnPropertyNames()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", "Object.getOwnPropertyNames()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames",
"Object.keys()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys", "Object.keys()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys",
"Object.hasOwnProperty()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", "Object.prototype.hasOwnProperty()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty",
// ======== STRING METHODS // ======== STRING METHODS
"String.charAt()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt", "String.prototype.charAt()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt",
"String.prototype.charCodeAt()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt", "String.prototype.charCodeAt()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt",
"String.concat()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat", "String.prototype.concat()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat",
"String.indexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf", "String.prototype.indexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf",
"String.fromCharCode()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode", "String.fromCharCode()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode",
"String.lastIndexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf", "String.prototype.lastIndexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf",
"String.match()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match", "String.prototype.match()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match",
"String.replace()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace", "String.prototype.replace()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace",
"String.slice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice", "String.prototype.slice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice",
"String.split()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split", "String.prototype.split()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split",
"String.substring()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring", "String.prototype.substring()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring",
"String.substr()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr", "String.prototype.substr()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr",
"String.toLowerCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase", "String.prototype.toLowerCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase",
"String.toString()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString", "String.prototype.toString()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toString",
"String.toUpperCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase", "String.prototype.toUpperCase()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase",
// ======== ARRAY METHODS // ======== ARRAY METHODS
"Array.concat()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat", "Array.prototype.concat()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat",
"Array.every()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every", "Array.prototype.every()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every",
"Array.filter()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter", "Array.prototype.filter()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter",
"Array.forEach()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach", "Array.prototype.forEach()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach",
"Array.indexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf", "Array.prototype.indexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf",
"Array.isArray()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray", "Array.isArray()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray",
"Array.join()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join", "Array.prototype.join()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join",
"Array.lastIndexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf", "Array.prototype.lastIndexOf()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf",
"Array.map()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map", "Array.prototype.map()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map",
"Array.pop()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop", "Array.prototype.pop()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop",
"Array.push()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push", "Array.prototype.push()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push",
"Array.reduce()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce", "Array.prototype.reduce()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce",
"Array.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse", "Array.prototype.reverse()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse",
"Array.shift()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift", "Array.prototype.shift()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift",
"Array.slice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice", "Array.prototype.slice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice",
"Array.some()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some", "Array.prototype.some()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some",
"Array.sort()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort", "Array.prototype.sort()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort",
"Array.splice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice", "Array.prototype.splice()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice",
"Array.toString()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString", "Array.prototype.toString()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString",
// ======== STATEMENTS AND DECLARATIONS // ======== STATEMENTS AND DECLARATIONS
"Switch Statement": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch", "Switch Statement": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch",
@ -86,7 +86,7 @@ var links = {
"Math.max()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max", "Math.max()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max",
"Math.min()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min", "Math.min()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min",
"Math.pow()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow", "Math.pow()": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow",
"Remainder": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_(.25)", "Remainder": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder",
// ======== GENERAL JAVASCRIPT REFERENCES // ======== GENERAL JAVASCRIPT REFERENCES
"Arithmetic Operators": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators", "Arithmetic Operators": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators",

View File

@ -649,19 +649,19 @@
}, },
{ {
"id": "560add71cb82ac38a17513c2", "id": "560add71cb82ac38a17513c2",
"title": "Join a Campsite in Your City", "title": "Join a Free Code Camp Group in Your City",
"description": [ "description": [
[ [
"//i.imgur.com/XugIMb4.jpg", "//i.imgur.com/XugIMb4.jpg",
"A picture of some of our campers meeting in a local cafe.", "A picture of some of our campers meeting in a local cafe.",
"Our Campsites are Facebook groups that help you meet other campers in your city. You can use these groups to plan and attend casual \"coffee-and-code\" events, where you meet other campers at a café and code together.", "You can code together with other campers in your city by joining a local Free Code Camp group.",
"" ""
], ],
[ [
"//i.imgur.com/fTFMjwf.gif", "//i.imgur.com/fTFMjwf.gif",
"A gif showing how you can click the link below, find your city on the list of Campsites, then click on the Facebook link for your city and join your city's Facebook group.", "A gif showing how you can click the link below, find your city on the list of local groups.",
"Find your city on this list and click it. This will take you to your city's Campsite's Facebook group. Click the \"Join group\" button to apply to join your city's Facebook group. Someone from the campsite should approve you shortly. If your city isn't on this list, scroll to the top of the wiki article for instructions for how you can create your city's Campsite.", "Find your city on this list and click it. This will take you to its Facebook page. Click the \"Join group\" button. Someone from the group should approve you shortly. If your city isn't on this list, scroll to the top of the wiki article for instructions on how you can start a group in your city.",
"https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/LocalGroups-List" "https://www.freecodecamp.com/wiki/en/localgroups-list/"
] ]
], ],
"challengeSeed": [], "challengeSeed": [],

View File

@ -25,7 +25,7 @@
"telephoneCheck(\"555-555-5555\");" "telephoneCheck(\"555-555-5555\");"
], ],
"solutions": [ "solutions": [
"var re = /^(?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:\\(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*\\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})$/;\n\nfunction telephoneCheck(str) {\n return !!str.match(re);\n}\n\ntelephoneCheck(\"555-555-5555\");" "var re = /^([+]?1[\\s]?)?((?:[(](?:[2-9]1[02-9]|[2-9][02-8][0-9])[)][\\s]?)|(?:(?:[2-9]1[02-9]|[2-9][02-8][0-9])[\\s.-]?)){1}([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2}[\\s.-]?){1}([0-9]{4}){1}$/;\n\nfunction telephoneCheck(str) {\n return re.test(str);\n}\n\ntelephoneCheck(\"555-555-5555\");"
], ],
"tests": [ "tests": [
"assert(typeof telephoneCheck(\"555-555-5555\") === \"boolean\", 'message: <code>telephoneCheck(\"555-555-5555\")</code> should return a boolean.');", "assert(typeof telephoneCheck(\"555-555-5555\") === \"boolean\", 'message: <code>telephoneCheck(\"555-555-5555\")</code> should return a boolean.');",
@ -35,6 +35,8 @@
"assert(telephoneCheck(\"555-555-5555\") === true, 'message: <code>telephoneCheck(\"555-555-5555\")</code> should return true.');", "assert(telephoneCheck(\"555-555-5555\") === true, 'message: <code>telephoneCheck(\"555-555-5555\")</code> should return true.');",
"assert(telephoneCheck(\"(555)555-5555\") === true, 'message: <code>telephoneCheck(\"(555)555-5555\")</code> should return true.');", "assert(telephoneCheck(\"(555)555-5555\") === true, 'message: <code>telephoneCheck(\"(555)555-5555\")</code> should return true.');",
"assert(telephoneCheck(\"1(555)555-5555\") === true, 'message: <code>telephoneCheck(\"1(555)555-5555\")</code> should return true.');", "assert(telephoneCheck(\"1(555)555-5555\") === true, 'message: <code>telephoneCheck(\"1(555)555-5555\")</code> should return true.');",
"assert(telephoneCheck(\"555-5555\") === false, 'message: <code>telephoneCheck(\"555-5555\")</code> should return false.');",
"assert(telephoneCheck(\"5555555\") === false, 'message: <code>telephoneCheck(\"5555555\")</code> should return false.');",
"assert(telephoneCheck(\"1 555)555-5555\") === false, 'message: <code>telephoneCheck(\"1 555)555-5555\")</code> should return false.');", "assert(telephoneCheck(\"1 555)555-5555\") === false, 'message: <code>telephoneCheck(\"1 555)555-5555\")</code> should return false.');",
"assert(telephoneCheck(\"1 555 555 5555\") === true, 'message: <code>telephoneCheck(\"1 555 555 5555\")</code> should return true.');", "assert(telephoneCheck(\"1 555 555 5555\") === true, 'message: <code>telephoneCheck(\"1 555 555 5555\")</code> should return true.');",
"assert(telephoneCheck(\"1 456 789 4444\") === true, 'message: <code>telephoneCheck(\"1 456 789 4444\")</code> should return true.');", "assert(telephoneCheck(\"1 456 789 4444\") === true, 'message: <code>telephoneCheck(\"1 456 789 4444\")</code> should return true.');",
@ -51,7 +53,8 @@
"assert(telephoneCheck(\"2(757)6227382\") === false, 'message: <code>telephoneCheck(\"2(757)6227382\")</code> should return false.');", "assert(telephoneCheck(\"2(757)6227382\") === false, 'message: <code>telephoneCheck(\"2(757)6227382\")</code> should return false.');",
"assert(telephoneCheck(\"2(757)622-7382\") === false, 'message: <code>telephoneCheck(\"2(757)622-7382\")</code> should return false.');", "assert(telephoneCheck(\"2(757)622-7382\") === false, 'message: <code>telephoneCheck(\"2(757)622-7382\")</code> should return false.');",
"assert(telephoneCheck(\"555)-555-5555\") === false, 'message: <code>telephoneCheck(\"555)-555-5555\")</code> should return false.');", "assert(telephoneCheck(\"555)-555-5555\") === false, 'message: <code>telephoneCheck(\"555)-555-5555\")</code> should return false.');",
"assert(telephoneCheck(\"(555-555-5555\") === false, 'message: <code>telephoneCheck(\"(555-555-5555\")</code> should return false.');" "assert(telephoneCheck(\"(555-555-5555\") === false, 'message: <code>telephoneCheck(\"(555-555-5555\")</code> should return false.');",
"assert(telephoneCheck(\"(555)5(55?)-5555\") === false, 'message: <code>telephoneCheck(\"(555)5(55?)-5555\")</code> should return false.');"
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
@ -99,7 +102,7 @@
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Array.reduce()", "Array.prototype.reduce()",
"Symmetric Difference" "Symmetric Difference"
], ],
"challengeType": 5, "challengeType": 5,
@ -297,8 +300,8 @@
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"String.split()", "String.prototype.split()",
"String.substr()", "String.prototype.substr()",
"parseInt()" "parseInt()"
], ],
"challengeType": 5, "challengeType": 5,
@ -436,7 +439,7 @@
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Array.reduce()" "Array.prototype.reduce()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "En parejas", "titleEs": "En parejas",

View File

@ -95,9 +95,9 @@
], ],
"MDNlinks": [ "MDNlinks": [
"Global String Object", "Global String Object",
"String.split()", "String.prototype.split()",
"Array.reverse()", "Array.prototype.reverse()",
"Array.join()" "Array.prototype.join()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Invierte el texto", "titleEs": "Invierte el texto",
@ -158,6 +158,7 @@
"A <dfn>palindrome</dfn> is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.", "A <dfn>palindrome</dfn> is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.",
"<strong>Note</strong><br>You'll need to remove <strong>all non-alphanumeric characters</strong> (punctuation, spaces and symbols) and turn everything lower case in order to check for palindromes.", "<strong>Note</strong><br>You'll need to remove <strong>all non-alphanumeric characters</strong> (punctuation, spaces and symbols) and turn everything lower case in order to check for palindromes.",
"We'll pass strings with varying formats, such as <code>\"racecar\"</code>, <code>\"RaceCar\"</code>, and <code>\"race CAR\"</code> among others.", "We'll pass strings with varying formats, such as <code>\"racecar\"</code>, <code>\"RaceCar\"</code>, and <code>\"race CAR\"</code> among others.",
"We'll also pass strings with special symbols, such as <code>\"2A3*3a2\"</code>, <code>\"2A3 3a2\"</code>, and <code>\"2_A3*3#A2\"</code>.",
"Remember to use <a href=\"//github.com/FreeCodeCamp/freecodecamp/wiki/FreeCodeCamp-Get-Help\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code." "Remember to use <a href=\"//github.com/FreeCodeCamp/freecodecamp/wiki/FreeCodeCamp-Get-Help\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
], ],
"challengeSeed": [ "challengeSeed": [
@ -173,6 +174,7 @@
"tests": [ "tests": [
"assert(typeof palindrome(\"eye\") === \"boolean\", 'message: <code>palindrome(\"eye\")</code> should return a boolean.');", "assert(typeof palindrome(\"eye\") === \"boolean\", 'message: <code>palindrome(\"eye\")</code> should return a boolean.');",
"assert(palindrome(\"eye\") === true, 'message: <code>palindrome(\"eye\")</code> should return true.');", "assert(palindrome(\"eye\") === true, 'message: <code>palindrome(\"eye\")</code> should return true.');",
"assert(palindrome(\"_eye\") === true, 'message: <code>palindrome(\"_eye\")</code> should return true.');",
"assert(palindrome(\"race car\") === true, 'message: <code>palindrome(\"race car\")</code> should return true.');", "assert(palindrome(\"race car\") === true, 'message: <code>palindrome(\"race car\")</code> should return true.');",
"assert(palindrome(\"not a palindrome\") === false, 'message: <code>palindrome(\"not a palindrome\")</code> should return false.');", "assert(palindrome(\"not a palindrome\") === false, 'message: <code>palindrome(\"not a palindrome\")</code> should return false.');",
"assert(palindrome(\"A man, a plan, a canal. Panama\") === true, 'message: <code>palindrome(\"A man, a plan, a canal. Panama\")</code> should return true.');", "assert(palindrome(\"A man, a plan, a canal. Panama\") === true, 'message: <code>palindrome(\"A man, a plan, a canal. Panama\")</code> should return true.');",
@ -190,8 +192,8 @@
"function palindrome(str) {\n var string = str.toLowerCase().split(/[^A-Za-z0-9]/gi).join('');\n var aux = string.split('');\n if (aux.join('') === aux.reverse().join('')){\n return true;\n }\n\n return false;\n}" "function palindrome(str) {\n var string = str.toLowerCase().split(/[^A-Za-z0-9]/gi).join('');\n var aux = string.split('');\n if (aux.join('') === aux.reverse().join('')){\n return true;\n }\n\n return false;\n}"
], ],
"MDNlinks": [ "MDNlinks": [
"String.replace()", "String.prototype.replace()",
"String.toLowerCase()" "String.prototype.toLowerCase()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Verifica si es palíndromo", "titleEs": "Verifica si es palíndromo",
@ -232,7 +234,7 @@
"function findLongestWord(str) {\n return str.split(' ').sort(function(a, b) { return b.length - a.length;})[0].length;\n}\n\nfindLongestWord('The quick brown fox jumped over the lazy dog');\n" "function findLongestWord(str) {\n return str.split(' ').sort(function(a, b) { return b.length - a.length;})[0].length;\n}\n\nfindLongestWord('The quick brown fox jumped over the lazy dog');\n"
], ],
"MDNlinks": [ "MDNlinks": [
"String.split()", "String.prototype.split()",
"String.length" "String.length"
], ],
"challengeType": 5, "challengeType": 5,
@ -270,7 +272,7 @@
"function titleCase(str) {\n return str.split(' ').map(function(word) {\n return word.charAt(0).toUpperCase() + word.substring(1).toLowerCase();\n }).join(' ');\n}\n\ntitleCase(\"I'm a little tea pot\");\n" "function titleCase(str) {\n return str.split(' ').map(function(word) {\n return word.charAt(0).toUpperCase() + word.substring(1).toLowerCase();\n }).join(' ');\n}\n\ntitleCase(\"I'm a little tea pot\");\n"
], ],
"MDNlinks": [ "MDNlinks": [
"String.split()" "String.prototype.split()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Aplica formato de título", "titleEs": "Aplica formato de título",
@ -349,7 +351,7 @@
"function confirmEnding(str, target) {\n return str.substring(str.length-target.length) === target;\n};\n" "function confirmEnding(str, target) {\n return str.substring(str.length-target.length) === target;\n};\n"
], ],
"MDNlinks": [ "MDNlinks": [
"String.substr()" "String.prototype.substr()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Confirma la terminación", "titleEs": "Confirma la terminación",
@ -427,7 +429,7 @@
"function truncateString(str, num) {\n if(str.length > num ) {\n if(num > 3) {\n return str.slice(0, num - 3) + '...';\n } else {\n return str.slice(0,num) + '...';\n }\n } \n return str;\n}" "function truncateString(str, num) {\n if(str.length > num ) {\n if(num > 3) {\n return str.slice(0, num - 3) + '...';\n } else {\n return str.slice(0,num) + '...';\n }\n } \n return str;\n}"
], ],
"MDNlinks": [ "MDNlinks": [
"String.slice()" "String.prototype.slice()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Trunca una cadena de texto", "titleEs": "Trunca una cadena de texto",
@ -468,8 +470,8 @@
"function chunkArrayInGroups(arr, size) {\n var out = [];\n for (var i = 0; i < arr.length; i+=size) {\n out.push(arr.slice(i,i+size));\n }\n return out;\n}\n\nchunkArrayInGroups(['a', 'b', 'c', 'd'], 2);\n" "function chunkArrayInGroups(arr, size) {\n var out = [];\n for (var i = 0; i < arr.length; i+=size) {\n out.push(arr.slice(i,i+size));\n }\n return out;\n}\n\nchunkArrayInGroups(['a', 'b', 'c', 'd'], 2);\n"
], ],
"MDNlinks": [ "MDNlinks": [
"Array.push()", "Array.prototype.push()",
"Array.slice()" "Array.prototype.slice()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "En mil pedazos", "titleEs": "En mil pedazos",
@ -508,8 +510,8 @@
"function slasher(arr, howMany) {\n // it doesn't always pay to be first\n return arr.slice(howMany);\n}\n\nslasher([1, 2, 3], 2);\n" "function slasher(arr, howMany) {\n // it doesn't always pay to be first\n return arr.slice(howMany);\n}\n\nslasher([1, 2, 3], 2);\n"
], ],
"MDNlinks": [ "MDNlinks": [
"Array.slice()", "Array.prototype.slice()",
"Array.splice()" "Array.prototype.splice()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Vuélale la cabeza", "titleEs": "Vuélale la cabeza",
@ -553,7 +555,7 @@
"function mutation(arr) {\n var hash = Object.create(null);\n arr[0].toLowerCase().split('').forEach(function(c) {\n hash[c] = true;\n });\n return !arr[1].toLowerCase().split('').filter(function(c) {\n return !hash[c];\n }).length;\n}\n\nmutation(['hello', 'hey']);\n" "function mutation(arr) {\n var hash = Object.create(null);\n arr[0].toLowerCase().split('').forEach(function(c) {\n hash[c] = true;\n });\n return !arr[1].toLowerCase().split('').filter(function(c) {\n return !hash[c];\n }).length;\n}\n\nmutation(['hello', 'hey']);\n"
], ],
"MDNlinks": [ "MDNlinks": [
"String.indexOf()" "String.prototype.indexOf()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Mutaciones", "titleEs": "Mutaciones",
@ -594,7 +596,7 @@
], ],
"MDNlinks": [ "MDNlinks": [
"Boolean Objects", "Boolean Objects",
"Array.filter()" "Array.prototype.filter()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Detector de mentiras", "titleEs": "Detector de mentiras",
@ -633,7 +635,7 @@
], ],
"MDNlinks": [ "MDNlinks": [
"Arguments object", "Arguments object",
"Array.filter()" "Array.prototype.filter()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "Buscar y destruir", "titleEs": "Buscar y destruir",
@ -674,7 +676,7 @@
"function getIndexToIns(arr, num) {\n arr = arr.sort(function(a, b){return a-b;});\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] >= num)\n {\n return i;\n }\n }\n return arr.length;\n}" "function getIndexToIns(arr, num) {\n arr = arr.sort(function(a, b){return a-b;});\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] >= num)\n {\n return i;\n }\n }\n return arr.length;\n}"
], ],
"MDNlinks": [ "MDNlinks": [
"Array.sort()" "Array.prototype.sort()"
], ],
"challengeType": 5, "challengeType": 5,
"titleEs": "¿Cuál es mi asiento?", "titleEs": "¿Cuál es mi asiento?",

View File

@ -1036,10 +1036,14 @@
"title": "Escape Sequences in Strings", "title": "Escape Sequences in Strings",
"description": [ "description": [
"Quotes are not the only characters that can be <dfn>escaped</dfn> inside a string. Here is a table of common escape sequences:", "Quotes are not the only characters that can be <dfn>escaped</dfn> inside a string. Here is a table of common escape sequences:",
"<table class=\"table table-striped\"><thead><tr><th>Code</th><th>Output</th></tr></thead><tbody><tr><td>\\'</td><td>single quote</td></tr><tr><td>\\\"</td><td>double quote</td></tr><tr><td>\\\\</td><td>backslash</td></tr><tr><td>\\n</td><td>new line</td></tr><tr><td>\\r</td><td>carriage return</td></tr><tr><td>\\t</td><td>tab</td></tr><tr><td>\\b</td><td>backspace</td></tr><tr><td>\\f</td><td>form feed</td></tr></tbody></table>", "<table class=\"table table-striped\"><thead><tr><th>Code</th><th>Output</th></tr></thead><tbody><tr><td><code>\\'</code></td><td>single quote</td></tr><tr><td><code>\\\"</code></td><td>double quote</td></tr><tr><td><code>\\\\</code></td><td>backslash</td></tr><tr><td><code>\\n</code></td><td>new line</td></tr><tr><td><code>\\r</code></td><td>carriage return</td></tr><tr><td><code>\\t</code></td><td>tab</td></tr><tr><td><code>\\b</code></td><td>backspace</td></tr><tr><td><code>\\f</code></td><td>form feed</td></tr></tbody></table>",
"<em>Note that the backslash itself must be escaped in order to display as a backslash.</em>", "<em>Note that the backslash itself must be escaped in order to display as a backslash.</em>",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"Encode the following sequence, separated by spaces:<br><code>backslash tab tab carriage-return new-line</code> and assign it to <code>myStr</code>" "Assign the following two lines of text into the single variable <code>myStr</code> using escape sequences.",
"<blockquote>Here is a backslash: \\.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Here is a new line with two tabs.</blockquote>",
"You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above with no additional spaces between each escape sequence.",
"Here is the text with the escape sequences written out.",
"<q>Here is a backslash: <code>backslash</code>.<code>newline</code> <code>tab</code> <code>tab</code> Here is a new line with two tabs.</q>"
], ],
"releasedOn": "January 1, 2016", "releasedOn": "January 1, 2016",
"challengeSeed": [ "challengeSeed": [
@ -1054,10 +1058,14 @@
"else{return null;}})();" "else{return null;}})();"
], ],
"solutions": [ "solutions": [
"var myStr = \"\\\\ \\t \\t \\r \\n\";" "var myStr = \"Here is a backslash: \\\\.\\n\\t\\tHere is a new line with two tabs.\";"
], ],
"tests": [ "tests": [
"assert(myStr === \"\\\\ \\t \\t \\r \\n\", 'message: <code>myStr</code> should have the escape sequences for <code>backslash tab tab carriage-return new-line</code> separated by spaces');" "assert(myStr === \"Here is a backslash: \\\\.\\n\\t\\tHere is a new line with two tabs.\", 'message: <code>myStr</code> should have encoded text with the proper escape sequences and spacing.');",
"assert(myStr.match(/\\t/g).length == 2, 'message: <code>myStr</code> should have two tab characters <code>\\t</code>');",
"assert(myStr.match(/\\n/g).length == 1, 'message: <code>myStr</code> should have one newline character <code>\\n</code>');",
"assert(myStr.match(/\\\\/g).length == 1, 'message: <code>myStr</code> should have a correctly escaped backslash character <code>\\\\</code>');",
"assert(myStr === \"Here is a backslash: \\\\.\\n\\t\\tHere is a new line with two tabs.\", 'message: <code>myStr</code> should not have any spaces in between consecutive escape sequences.');"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1, "challengeType": 1,
@ -1263,7 +1271,7 @@
], ],
"tests": [ "tests": [
"assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, 'message: <code>someAdjective</code> should be set to a string at least 3 characters long');", "assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2, 'message: <code>someAdjective</code> should be set to a string at least 3 characters long');",
"assert(code.match(/\\w\\s*\\+=\\s*someAdjective\\s*;/).length > 0, 'message: Append <code>someAdjective</code> to <code>myStr</code> using the <code>+=</code> operator');" "assert(code.match(/myStr\\s*\\+=\\s*someAdjective\\s*/).length > 0, 'message: Append <code>someAdjective</code> to <code>myStr</code> using the <code>+=</code> operator');"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1, "challengeType": 1,
@ -1551,7 +1559,7 @@
"description": [ "description": [
"We will now use our knowledge of strings to build a \"<a href='https://en.wikipedia.org/wiki/Mad_Libs' target='_blank'>Mad Libs</a>\" style word game we're calling \"Word Blanks\". You will create an (optionally humorous) \"Fill in the Blanks\" style sentence.", "We will now use our knowledge of strings to build a \"<a href='https://en.wikipedia.org/wiki/Mad_Libs' target='_blank'>Mad Libs</a>\" 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, <code>result</code>, using the provided variables: <code>myNoun</code>, <code>myAdjective</code>, <code>myVerb</code>, and <code>myAdverb</code>.", "You will need to use string operators to build a new string, <code>result</code>, using the provided variables: <code>myNoun</code>, <code>myAdjective</code>, <code>myVerb</code>, and <code>myAdverb</code>.",
"You will also need to provide additional strings, which will not change, in between the provided words.", "You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.",
"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." "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", "releasedOn": "January 1, 2016",
@ -1577,8 +1585,8 @@
], ],
"tests": [ "tests": [
"assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: <code>wordBlanks(\"\",\"\",\"\",\"\")</code> should return a string.');", "assert(typeof wordBlanks(\"\",\"\",\"\",\"\") === 'string', 'message: <code>wordBlanks(\"\",\"\",\"\",\"\")</code> should return a string.');",
"assert(/\\bdog\\b/.test(test1) && /\\bbig\\b/.test(test1) && /\\bran\\b/.test(test1) && /\\bquickly\\b/.test(test1),'message: <code>wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\")</code> should contain all of the passed words separated by non-word characters (and any additional words in your madlib).');", "assert(/\\bdog\\b/.test(test1) && /\\bbig\\b/.test(test1) && /\\bran\\b/.test(test1) && /\\bquickly\\b/.test(test1),'message: <code>wordBlanks(\"dog\", \"big\", \"ran\", \"quickly\")</code> should contain all of the passed in 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: <code>wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\")</code> 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: <code>wordBlanks(\"cat\", \"little\", \"hit\", \"slowly\")</code> should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).');"
], ],
"type": "checkpoint", "type": "checkpoint",
"challengeType": 1, "challengeType": 1,
@ -1595,9 +1603,10 @@
"title": "Store Multiple Values in one Variable using JavaScript Arrays", "title": "Store Multiple Values in one Variable using JavaScript Arrays",
"description": [ "description": [
"With JavaScript <code>array</code> variables, we can store several pieces of data in one place.", "With JavaScript <code>array</code> 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:<br><code>var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]</code>.", "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: ",
"<code>var sandwich = [\"peanut butter\", \"jelly\", \"bread\"]</code>.",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"Create a new array called <code>myArray</code> that contains both a <code>string</code> and a <code>number</code> (in that order).", "Modify the new array <code>myArray</code> so that it contains both a <code>string</code> and a <code>number</code> (in that order).",
"<strong>Hint</strong><br>Refer to the example code in the text editor if you get stuck." "<strong>Hint</strong><br>Refer to the example code in the text editor if you get stuck."
], ],
"challengeSeed": [ "challengeSeed": [
@ -1673,7 +1682,7 @@
"<strong>Example</strong>", "<strong>Example</strong>",
"<blockquote>var array = [1,2,3];<br>array[0]; // equals 1<br>var data = array[1]; // equals 2</blockquote>", "<blockquote>var array = [1,2,3];<br>array[0]; // equals 1<br>var data = array[1]; // equals 2</blockquote>",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"Create a variable called <code>myData</code> and set it to equal the first value of <code>myArray</code>." "Create a variable called <code>myData</code> and set it to equal the first value of <code>myArray</code> using bracket notation."
], ],
"challengeSeed": [ "challengeSeed": [
"// Example", "// Example",
@ -1693,7 +1702,8 @@
"var myArray = [1,2,3];\nvar myData = myArray[0];" "var myArray = [1,2,3];\nvar myData = myArray[0];"
], ],
"tests": [ "tests": [
"assert((function(){if(typeof myArray != 'undefined' && typeof myData != 'undefined' && myArray[0] === myData){return true;}else{return false;}})(), 'message: The variable <code>myData</code> should equal the first value of <code>myArray</code>.');" "assert((function(){if(typeof myArray !== 'undefined' && typeof myData !== 'undefined' && myArray[0] === myData){return true;}else{return false;}})(), 'message: The variable <code>myData</code> should equal the first value of <code>myArray</code>.');",
"assert((function(){if(code.match(/\\s*=\\s*myArray\\[0\\]/g)){return true;}else{return false;}})(), 'message: The data in variable <code>myArray</code> should be accessed using bracket notation.');"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1, "challengeType": 1,
@ -1867,7 +1877,8 @@
"var myArray = [[\"John\", 23], [\"cat\", 2]];\nvar removedFromMyArray = myArray.pop();" "var myArray = [[\"John\", 23], [\"cat\", 2]];\nvar removedFromMyArray = myArray.pop();"
], ],
"tests": [ "tests": [
"assert((function(d){if(d[0][0] == 'John' && d[0][1] == 23 && d[2] == undefined){return true;}else{return false;}})(myArray), 'message: <code>myArray</code> should only contain <code>[[\"John\", 23]]</code>.');", "assert((function(d){if(d[0][0] == 'John' && d[0][1] == 23 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: <code>myArray</code> should only contain <code>[[\"John\", 23]]</code>.');",
"assert(/removedFromMyArray\\s*=\\s*myArray\\s*.\\s*pop\\s*(\\s*)/.test(code), 'message: Use <code>pop()</code> on <code>myArray</code>');",
"assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: <code>removedFromMyArray</code> should only contain <code>[\"cat\", 2]</code>.');" "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: <code>removedFromMyArray</code> should only contain <code>[\"cat\", 2]</code>.');"
], ],
"type": "waypoint", "type": "waypoint",
@ -2042,19 +2053,7 @@
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"<ol><li>Create a function called <code>reusableFunction</code> which prints <code>\"Hi World\"</code> to the dev console.</li><li>Call the function.</li></ol>" "<ol><li>Create a function called <code>reusableFunction</code> which prints <code>\"Hi World\"</code> to the dev console.</li><li>Call the function.</li></ol>"
], ],
"challengeSeed": [ "head": [
"// Example",
"function reusableFunction() {",
" console.log(\"Heyya, World\");",
"}",
"",
"reusableFunction();",
"",
"// Only change code below this line",
"",
""
],
"tail": [
"var logOutput = \"\";", "var logOutput = \"\";",
"var originalConsole = console", "var originalConsole = console",
"function capture() {", "function capture() {",
@ -2074,12 +2073,26 @@
" console.log = originalConsole.log;", " console.log = originalConsole.log;",
"}", "}",
"", "",
"capture();"
],
"challengeSeed": [
"// Example",
"function reusableFunction() {",
" console.log(\"Heyya, World\");",
"}",
"",
"reusableFunction();",
"",
"// Only change code below this line",
"",
""
],
"tail": [
"uncapture();",
"",
"if (typeof reusableFunction !== \"function\") { ", "if (typeof reusableFunction !== \"function\") { ",
" (function() { return \"reusableFunction is not defined\"; })();", " (function() { return \"reusableFunction is not defined\"; })();",
"} else {", "} else {",
" capture();",
" reusableFunction(); ",
" uncapture();",
" (function() { return logOutput || \"console.log never called\"; })();", " (function() { return logOutput || \"console.log never called\"; })();",
"}" "}"
], ],
@ -2690,7 +2703,7 @@
"assert(testEqual(10) === \"Not Equal\", 'message: <code>testEqual(10)</code> should return \"Not Equal\"');", "assert(testEqual(10) === \"Not Equal\", 'message: <code>testEqual(10)</code> should return \"Not Equal\"');",
"assert(testEqual(12) === \"Equal\", 'message: <code>testEqual(12)</code> should return \"Equal\"');", "assert(testEqual(12) === \"Equal\", 'message: <code>testEqual(12)</code> should return \"Equal\"');",
"assert(testEqual(\"12\") === \"Equal\", 'message: <code>testEqual(\"12\")</code> should return \"Equal\"');", "assert(testEqual(\"12\") === \"Equal\", 'message: <code>testEqual(\"12\")</code> should return \"Equal\"');",
"assert(code.match(/val\\s*==[\\s'\"\\d]+/g).length > 0, 'message: You should use the <code>==</code> operator');" "assert(code.match(/==/g) && !code.match(/===/g), 'message: You should use the <code>==</code> operator');"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1, "challengeType": 1,
@ -3384,7 +3397,7 @@
"id": "5664820f61c48e80c9fa476c", "id": "5664820f61c48e80c9fa476c",
"title": "Golf Code", "title": "Golf Code",
"description": [ "description": [
"In the game of <a href=\"https://en.wikipedia.org/wiki/Golf\" target=\"_blank\">golf</a> each hole has a <code>par</code> for the average number of <code>strokes</code> needed to sink the ball. Depending on how far above or below <code>par</code> your <code>strokes</code> are, there is a different nickname.", "In the game of <a href=\"https://en.wikipedia.org/wiki/Golf\" target=\"_blank\">golf</a> each hole has a <code>par</code> meaning the average number of <code>strokes</code> a golfer is expected to make in order to sink the ball in a hole to complete the play. Depending on how far above or below <code>par</code> your <code>strokes</code> are, there is a different nickname.",
"Your function will be passed <code>par</code> and <code>strokes</code> arguments. Return the correct string according to this table which lists the strokes in order of priority; top (highest) to bottom (lowest):", "Your function will be passed <code>par</code> and <code>strokes</code> arguments. Return the correct string according to this table which lists the strokes in order of priority; top (highest) to bottom (lowest):",
"<table class=\"table table-striped\"><thead><tr><th>Strokes</th><th>Return</th></tr></thead><tbody><tr><td>1</td><td>\"Hole-in-one!\"</td></tr><tr><td>&lt;= par - 2</td><td>\"Eagle\"</td></tr><tr><td>par - 1</td><td>\"Birdie\"</td></tr><tr><td>par</td><td>\"Par\"</td></tr><tr><td>par + 1</td><td>\"Bogey\"</td></tr><tr><td>par + 2</td><td>\"Double Bogey\"</td></tr><tr><td>&gt;= par + 3</td><td>\"Go Home!\"</td></tr></tbody></table>", "<table class=\"table table-striped\"><thead><tr><th>Strokes</th><th>Return</th></tr></thead><tbody><tr><td>1</td><td>\"Hole-in-one!\"</td></tr><tr><td>&lt;= par - 2</td><td>\"Eagle\"</td></tr><tr><td>par - 1</td><td>\"Birdie\"</td></tr><tr><td>par</td><td>\"Par\"</td></tr><tr><td>par + 1</td><td>\"Bogey\"</td></tr><tr><td>par + 2</td><td>\"Double Bogey\"</td></tr><tr><td>&gt;= par + 3</td><td>\"Go Home!\"</td></tr></tbody></table>",
"<code>par</code> and <code>strokes</code> will always be numeric and positive." "<code>par</code> and <code>strokes</code> will always be numeric and positive."
@ -4317,15 +4330,22 @@
}, },
{ {
"id": "56533eb9ac21ba0edf2244cb", "id": "56533eb9ac21ba0edf2244cb",
"title": "Introducing JavaScript Object Notation (JSON)", "title": "Manipulating Complex Objects",
"description": [ "description": [
"JavaScript Object Notation or <code>JSON</code> uses the format of JavaScript Objects to store data. JSON is flexible because it allows for <dfn>Data Structures</dfn> with arbitrary combinations of <dfn>strings</dfn>, <dfn>numbers</dfn>, <dfn>booleans</dfn>, <dfn>arrays</dfn>, and <dfn>objects</dfn>.", "JavaScript objects are flexible because they allow for <dfn>Data Structures</dfn> with arbitrary combinations of <dfn>strings</dfn>, <dfn>numbers</dfn>, <dfn>booleans</dfn>, <dfn>arrays</dfn>, <dfn>functions</dfn>, and <dfn>objects</dfn>.",
"Here is an example of a complex data structure:",
"<blockquote>var ourMusic = [<br> {<br> \"artist\": \"Daft Punk\",<br> \"title\": \"Homework\",<br> \"release_year\": 1997,<br> \"formats\": [ <br> \"CD\", <br> \"Cassette\", <br> \"LP\" ],<br> \"gold\": true<br> }<br>];</blockquote>",
"This is an array of objects and the object has various pieces of <dfn>metadata</dfn> about an album. It also has a nested <code>formats</code> array. Additional album records could be added to the top level array.",
"<strong>Note</strong><br>You will need a comma in between objects with more than one object in the array.",
"JavaScript Object Notation or <code>JSON</code> is a data interchange format used to store data (source: <a href=\"http://json.org/\">json.org</a>).",
"A property is the part of an object that associates a key (either a String value or a Symbol value) and a value (source: <a href=\"http://www.ecma-international.org/ecma-262/6.0/#sec-property\">ecma-international.org/ecma-262/6.0/#sec-property</a>). So, a property consists of a key - value pair. (source: <a href=\"http://spacetelescope.github.io/understanding-json-schema/reference/object.html#properties\">spacetelescope.github.io/understanding-json-schema/reference/object.html#properties</a>). Property keys (also known as names) should be in quotation marks.",
"Like JavaScript Objects, JSON is flexible because it is heterogeneous, meaning it permits <dfn>Data Structures</dfn> with arbitrary combinations of <dfn>strings</dfn>, <dfn>booleans</dfn>, <dfn>numbers</dfn>, <dfn>arrays</dfn>, and <dfn>objects</dfn>.",
"Here is an example of a JSON object:", "Here is an example of a JSON object:",
"<blockquote>var ourMusic = [<br> {<br> \"artist\": \"Daft Punk\",<br> \"title\": \"Homework\",<br> \"release_year\": 1997,<br> \"formats\": [ <br> \"CD\", <br> \"Cassette\", <br> \"LP\" ],<br> \"gold\": true<br> }<br>];</blockquote>", "<blockquote>var ourMusic = [<br> {<br> \"artist\": \"Daft Punk\",<br> \"title\": \"Homework\",<br> \"release_year\": 1997,<br> \"formats\": [ <br> \"CD\", <br> \"Cassette\", <br> \"LP\" ],<br> \"gold\": true<br> }<br>];</blockquote>",
"This is an array of objects and the object has various pieces of <dfn>metadata</dfn> about an album. It also has a nested <code>formats</code> array. Additional album records could be added to the top level array.", "This is an array of objects and the object has various pieces of <dfn>metadata</dfn> about an album. It also has a nested <code>formats</code> array. Additional album records could be added to the top level array.",
"<strong>Note</strong><br>You will need a comma in between objects in JSON objects with more than one object in the array.", "<strong>Note</strong><br>You will need to place a comma in between objects in JSON unless there is only one object in the array or containing object.",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"Add a new album to the <code>myMusic</code> JSON object. Add <code>artist</code> and <code>title</code> strings, <code>release_year</code> number, and a <code>formats</code> array of strings." "Add a new album to the <code>myMusic</code> object. Add <code>artist</code> and <code>title</code> strings, <code>release_year</code> number, and a <code>formats</code> array of strings."
], ],
"releasedOn": "January 1, 2016", "releasedOn": "January 1, 2016",
"challengeSeed": [ "challengeSeed": [
@ -4363,26 +4383,26 @@
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1, "challengeType": 1,
"titleEs": "Introducción a la notación de objetos de JavaScript (JSON - JavaScript Object Notation)", "titleEs": "Manipula objetos complicados",
"descriptionEs": [ "descriptionEs": [
"La notación de objetos de JavaScript o <code>JSON</code> usa el formato de objetos de JavaScript para almacenar datos. JSON es flexible porque permite <dfn>Estructuras de Datos</dfn> con combinaciones arbitrarias de <dfn>cadenas</dfn>, <dfn>números</dfn>, <dfn>booleanos</dfn>, <dfn>vectores</dfn> y <dfn>objetos</dfn>.", "Los objetos Javascript son flexibles porque permiten <dfn>Estructuras de Datos</dfn> con combinaciones arbitrarias de <dfn>cadenas</dfn>, <dfn>números</dfn>, <dfn>booleanos</dfn>, <dfn>vectores</dfn>, <dfn>funciones</dfn>, y <dfn>objetos</dfn>.",
"Aquí está un ejemplo de un objeto JSON:", "Aquí está un ejemplo de un objeto complicado:",
"<blockquote>var nuestraMusica = [<br> {<br> \"artista\": \"Daft Punk\",<br> \"titulo\": \"Homework\",<br> \"año_publicacion\": 1997,<br> \"formatos\": [ <br> \"CD\", <br> \"Cassette\", <br> \"LP\" ],<br> \"oro\": true<br> }<br>];</blockquote>", "<blockquote>var nuestraMusica = [<br> {<br> \"artista\": \"Daft Punk\",<br> \"titulo\": \"Homework\",<br> \"año_publicacion\": 1997,<br> \"formatos\": [ <br> \"CD\", <br> \"Cassette\", <br> \"LP\" ],<br> \"oro\": true<br> }<br>];</blockquote>",
"Este es un vector de objetos con diversos <dfn>metadatos</dfn> acerca de un álbum musical. Además tiene anidado un vector <code>formatos</code>. En el vector de nivel superior, pueden añadirse otros registros del álbum.", "Este es un vector de objetos con diversos <dfn>metadatos</dfn> acerca de un álbum musical. Además tiene anidado un vector <code>formatos</code>. En el vector de nivel superior, pueden añadirse otros registros del álbum.",
"<strong>Nota</strong><br>En objetos JSON que tengan más de un objeto en el vector, necesitarás separar un objeto de otro mediante comas.", "<strong>Nota</strong><br>En vectores que tengan más de un objeto, necesitarás separar un objeto de otro mediante comas.",
"<h4>Instrucciones</h4>", "<h4>Instrucciones</h4>",
"Agrega un nuevo álbum al objeto JSON <code>myMusic</code>. Agrega las cadenas <code>artist</code> y <code>title</code>, el número <code>release_year</code> y un vector de cadenas <code>formats</code>." "Agrega un nuevo álbum al objeto <code>myMusic</code>. Agrega las cadenas <code>artist</code> y <code>title</code>, el número <code>release_year</code> y un vector de cadenas <code>formats</code>."
] ]
}, },
{ {
"id": "56533eb9ac21ba0edf2244cc", "id": "56533eb9ac21ba0edf2244cc",
"title": "Accessing Nested Objects in JSON", "title": "Accessing Nested Objects",
"description": [ "description": [
"The properties and sub-properties of JSON objects can be accessed by chaining together the dot or bracket notation.", "The sub-properties of objects can be accessed by chaining together the dot or bracket notation.",
"Here is a nested JSON Object:", "Here is a nested object:",
"<blockquote>var ourStorage = {<br> \"desk\": {<br> \"drawer\": \"stapler\"<br> },<br> \"cabinet\": {<br> \"top drawer\": { <br> \"folder1\": \"a file\",<br> \"folder2\": \"secrets\"<br> },<br> \"bottom drawer\": \"soda\"<br> }<br>}<br>ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"<br>ourStorage.desk.drawer; // \"stapler\"</blockquote>", "<blockquote>var ourStorage = {<br> \"desk\": {<br> \"drawer\": \"stapler\"<br> },<br> \"cabinet\": {<br> \"top drawer\": { <br> \"folder1\": \"a file\",<br> \"folder2\": \"secrets\"<br> },<br> \"bottom drawer\": \"soda\"<br> }<br>}<br>ourStorage.cabinet[\"top drawer\"].folder2; // \"secrets\"<br>ourStorage.desk.drawer; // \"stapler\"</blockquote>",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
"Access the <code>myStorage</code> JSON object to retrieve the contents of the <code>glove box</code>. Use bracket notation for properties with a space in their name." "Access the <code>myStorage</code> object to retrieve the contents of the <code>glove box</code>. Use bracket notation for properties with a space in their name."
], ],
"releasedOn": "January 1, 2016", "releasedOn": "January 1, 2016",
"challengeSeed": [ "challengeSeed": [
@ -4421,20 +4441,20 @@
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1, "challengeType": 1,
"titleEs": "Acceder a objetos anidados en JSON", "titleEs": "Acceder a objetos anidados",
"descriptionEs": [ "descriptionEs": [
"Las propiedades y sub-propiedades de los objetos JSON pueden ser accesadas mediante encadenamiento de la notación punto o corchete.", "Las sub-propiedades de los objetos pueden ser accesadas mediante encadenamiento de la notación punto o corchete.",
"Aquí está un objeto JSON anidado:", "Aquí está un objeto anidado:",
"<blockquote>var nuestroAlmacen = {<br> \"escritorio\": {<br> \"cajon\": \"grapadora\"<br> },<br> \"armario\": {<br> \"cajón superior\": { <br> \"legajador1\": \"un archivo\",<br> \"legajador2\": \"secretos\"<br> },<br> \"cajón inferior\": \"gaseosa\"<br> }<br>}<br>nuestroAlmacen.armario[\"cajón superior\"].legajador2; // \"secretos\"<br>nuestroAlmacen.escritorio.cajon; // \"grapadora\"</blockquote>", "<blockquote>var nuestroAlmacen = {<br> \"escritorio\": {<br> \"cajon\": \"grapadora\"<br> },<br> \"armario\": {<br> \"cajón superior\": { <br> \"legajador1\": \"un archivo\",<br> \"legajador2\": \"secretos\"<br> },<br> \"cajón inferior\": \"gaseosa\"<br> }<br>}<br>nuestroAlmacen.armario[\"cajón superior\"].legajador2; // \"secretos\"<br>nuestroAlmacen.escritorio.cajon; // \"grapadora\"</blockquote>",
"<h4>Instrucciones</h4>", "<h4>Instrucciones</h4>",
"Accede al objeto JSON <code>myStorage</code> para recuperar el contenido de <code>glove box</code>. Usa notación corchete para las propiedades con un espacio en su nombre." "Accede al objeto <code>myStorage</code> para recuperar el contenido de <code>glove box</code>. Usa notación corchete para las propiedades con un espacio en su nombre."
] ]
}, },
{ {
"id": "56533eb9ac21ba0edf2244cd", "id": "56533eb9ac21ba0edf2244cd",
"title": "Accessing Nested Arrays in JSON", "title": "Accessing Nested Arrays",
"description": [ "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.", "As we have seen in earlier examples, 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:", "Here is an example of how to access a nested array:",
"<blockquote>var ourPets = [<br> {<br> animalType: \"cat\",<br> names: [<br> \"Meowzer\",<br> \"Fluffy\",<br> \"Kit-Cat\"<br> ]<br> },<br> {<br> animalType: \"dog\",<br> names: [<br> \"Spot\",<br> \"Bowser\",<br> \"Frankie\"<br> ]<br> }<br>];<br>ourPets[0].names[1]; // \"Fluffy\"<br>ourPets[1].names[0]; // \"Spot\"</blockquote>", "<blockquote>var ourPets = [<br> {<br> animalType: \"cat\",<br> names: [<br> \"Meowzer\",<br> \"Fluffy\",<br> \"Kit-Cat\"<br> ]<br> },<br> {<br> animalType: \"dog\",<br> names: [<br> \"Spot\",<br> \"Bowser\",<br> \"Frankie\"<br> ]<br> }<br>];<br>ourPets[0].names[1]; // \"Fluffy\"<br>ourPets[1].names[0]; // \"Spot\"</blockquote>",
"<h4>Instructions</h4>", "<h4>Instructions</h4>",
@ -4484,9 +4504,9 @@
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 1, "challengeType": 1,
"titleEs": "Acceder a vectores anidados en JSON", "titleEs": "Acceder a vectores anidados",
"descriptionEs": [ "descriptionEs": [
"Como hemos visto en ejemplos anteriores, los objetos JSON pueden contener objetos anidados y vectores anidados. De forma similar a acceder a objetos anidados, la notación corchete en vectores puede ser encadenada para acceder a vectores anidados.", "Como hemos visto en ejemplos anteriores, los objetos pueden contener objetos anidados y vectores anidados. De forma similar a acceder a objetos anidados, la notación corchete en vectores puede ser encadenada para acceder a vectores anidados.",
"Aquí está un ejemplo de como acceder a un vector anidado:", "Aquí está un ejemplo de como acceder a un vector anidado:",
"<blockquote>var nuestrasMascotas = { <br> \"gatos\": [<br> \"Maullador\",<br> \"Blandito\",<br> \"Kit-Cat\"<br> ],<br> \"perros\": [<br> \"Mancha\",<br> \"Bowser\",<br> \"Frankie\"<br> ]<br>};<br>nuestrasMascotas.cats[1]; // \"Blandito\"<br>nuestrasMascotas.dogs[0]; // \"Mancha\"</blockquote>", "<blockquote>var nuestrasMascotas = { <br> \"gatos\": [<br> \"Maullador\",<br> \"Blandito\",<br> \"Kit-Cat\"<br> ],<br> \"perros\": [<br> \"Mancha\",<br> \"Bowser\",<br> \"Frankie\"<br> ]<br>};<br>nuestrasMascotas.cats[1]; // \"Blandito\"<br>nuestrasMascotas.dogs[0]; // \"Mancha\"</blockquote>",
"<h4>Instrucciones</h4>", "<h4>Instrucciones</h4>",
@ -4497,46 +4517,49 @@
"id": "56533eb9ac21ba0edf2244cf", "id": "56533eb9ac21ba0edf2244cf",
"title": "Record Collection", "title": "Record Collection",
"description": [ "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 has several properties. Not all albums have complete information.", "You are given an 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.",
"You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number (its key) and has several properties. Not all albums have complete information.",
"Write a function which takes an <code>id</code>, a property (<code>prop</code>), and a <code>value</code>.", "Write a function which takes an <code>id</code>, a property (<code>prop</code>), and a <code>value</code>.",
"For the given <code>id</code> in <code>collection</code>:", "For the given <code>id</code> in <code>collection</code>:",
"If <code>value</code> is non-blank (<code>value !== \"\"</code>) and <code>prop</code> is not <code>\"tracks\"</code> then update or set the <code>value</code> for the <code>prop</code>.", "If <code>prop</code> does not contain the key <code>\"tracks\"</code>, then update or set the <code>value</code> for that incomplete <code>prop</code>.",
"If the <code>prop</code> is <code>\"tracks\"</code> and <code>value</code> is non-blank, push the <code>value</code> onto the end of the <code>tracks</code> array.", "If <code>prop</code> does not contain the key <code>\"tracks\"</code> before you update it, create an empty array before pushing a track to it.",
"If <code>\"tracks\"</code> is non-existent before you update it, create an empty array before pushing a track to it.", "If <code>prop</code> does contain the key <code>\"tracks\"</code> and its <code>value</code> is non-blank, then push the <code>value</code> onto the end of its existing <code>tracks</code> array.",
"If <code>value</code> is blank, delete that <code>prop</code>.", "If <code>value</code> is blank, delete that <code>prop</code>.",
"Always return the entire collection object.", "Always return the entire collection object.",
"<strong>Note</strong><br>Don't forget to use <code>bracket notation</code> when <a href=\"accessing-objects-properties-with-variables\" target=\"_blank\">accessing object properties with variables</a>." "<strong>Hints</strong><br>Use <code>bracket notation</code> when <a href=\"accessing-objects-properties-with-variables\" target=\"_blank\">accessing object properties with variables</a>.",
"Push is an array method you can read about on <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push\">Mozilla Developer Network</a>.",
"You may refer back to <a href=\"https://www.freecodecamp.com/challenges/introducing-javascript-object-notation-json\">Introducing JavaScript Object Notation (JSON)</a> for a refresher."
], ],
"releasedOn": "January 1, 2016", "releasedOn": "January 1, 2016",
"challengeSeed": [ "challengeSeed": [
"// Setup", "// Setup",
"var collection = {", "var collection = {",
" 2548: {", " \"2548\": {",
" album: \"Slippery When Wet\",", " \"album\": \"Slippery When Wet\",",
" artist: \"Bon Jovi\",", " \"artist\": \"Bon Jovi\",",
" tracks: [ ", " tracks: [ ",
" \"Let It Rock\", ", " \"Let It Rock\", ",
" \"You Give Love a Bad Name\" ", " \"You Give Love a Bad Name\" ",
" ]", " ]",
" },", " },",
" 2468: {", " \"2468\": {",
" album: \"1999\",", " \"album\": \"1999\",",
" artist: \"Prince\",", " \"artist\": \"Prince\",",
" tracks: [ ", " \"tracks\": [ ",
" \"1999\", ", " \"1999\", ",
" \"Little Red Corvette\" ", " \"Little Red Corvette\" ",
" ]", " ]",
" },", " },",
" 1245: {", " \"1245\": {",
" artist: \"Robert Palmer\",", " \"artist\": \"Robert Palmer\",",
" tracks: [ ]", " \"tracks\": [ ]",
" },", " },",
" 5439: {", " \"5439\": {",
" album: \"ABBA Gold\"", " \"album\": \"ABBA Gold\"",
" }", " }",
"};", "};",
"// Keep a copy of the collection for tests", "// Keep a copy of the collection for tests",
"var collectionCopy = JSON.parse(JSON.stringify(collection));", "var collectionCopy = JSON.parse(stringify(collection));",
"", "",
"// Only change code below this line", "// Only change code below this line",
"function updateRecords(id, prop, value) {", "function updateRecords(id, prop, value) {",
@ -4566,7 +4589,7 @@
"challengeType": 1, "challengeType": 1,
"titleEs": "Colección de registros", "titleEs": "Colección de registros",
"descriptionEs": [ "descriptionEs": [
"Se te da un objeto JSON que representa (una pequeña parte de) tu colección de grabaciones. Cada álbum es identificado por un número id único y tiene varias propiedades. No todos los álbumes tienen la información completa.", "Se te da un objeto que representa (una pequeña parte de) tu colección de grabaciones. Cada álbum es identificado por un número id único y tiene varias propiedades. No todos los álbumes tienen la información completa.",
"Escribe una función que reciba un <code>id</code>, una propiedad (<code>prop</code>) y un valor (<code>value</code>).", "Escribe una función que reciba un <code>id</code>, una propiedad (<code>prop</code>) y un valor (<code>value</code>).",
"Para el <code>id</code> dado, en la colección <code>collection</code>:", "Para el <code>id</code> dado, en la colección <code>collection</code>:",
"Si el valor <code>value</code> no está en blanco (<code>value !== \"\"</code>) y <code>prop</code> no es <code>\"tracks\"</code> entonces actualiza o establece el valor de la propiedad <code>prop</code>.", "Si el valor <code>value</code> no está en blanco (<code>value !== \"\"</code>) y <code>prop</code> no es <code>\"tracks\"</code> entonces actualiza o establece el valor de la propiedad <code>prop</code>.",

View File

@ -733,7 +733,8 @@
"assert($(\"p\").length > 1, 'message: You need 2 <code>p</code> elements with Kitty Ipsum text.');", "assert($(\"p\").length > 1, 'message: You need 2 <code>p</code> elements with Kitty Ipsum text.');",
"assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, 'message: Make sure each of your <code>p</code> elements has a closing tag.');", "assert(code.match(/<\\/p>/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, 'message: Make sure each of your <code>p</code> elements has a closing tag.');",
"assert.isTrue((/Purr\\s+jump\\s+eat/gi).test($(\"p\").text()), 'message: Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>.');", "assert.isTrue((/Purr\\s+jump\\s+eat/gi).test($(\"p\").text()), 'message: Your <code>p</code> element should contain the first few words of the provided additional <code>kitty ipsum text</code>.');",
"assert($(\"p:not([class])\").length === 1, 'message: Do not add a class attribute to the second <code>p</code> element.');", "assert($(\"p:eq(0)\").attr(\"class\") === \"red-text\", 'message: The first <code>p</code> element should have the class <code>red-text</code>.');",
"assert($(\"p:eq(1)\").attr(\"class\") === undefined, 'message: Do not add a class attribute to the second <code>p</code> element.');",
"assert(parseInt($(\"p:not([class])\").css(\"font-size\"), 10) > 15, 'message: Between the <code>style</code> tags, give the <code>p</code> elements <code>font-size</code> of <code>16px</code>. Browser and Text zoom should be at 100%.');" "assert(parseInt($(\"p:not([class])\").css(\"font-size\"), 10) > 15, 'message: Between the <code>style</code> tags, give the <code>p</code> elements <code>font-size</code> of <code>16px</code>. Browser and Text zoom should be at 100%.');"
], ],
"type": "waypoint", "type": "waypoint",
@ -1415,7 +1416,7 @@
], ],
"tests": [ "tests": [
"assert((/cat photos/gi).test($(\"a\").text()), 'message: Your <code>a</code> element should have the <code>anchor text</code> of \"cat photos\".');", "assert((/cat photos/gi).test($(\"a\").text()), 'message: Your <code>a</code> element should have the <code>anchor text</code> of \"cat photos\".');",
"assert(/http:\\/\\/freecatphotoapp\\.com/gi.test($(\"a\").attr(\"href\")), 'message: You need an <code>a</code> element that links to <code>http&#58;//freecatphotoapp.com</code>');", "assert(/http:\\/\\/freecatphotoapp\\.com/gi.test($(\"a\").attr(\"href\")), 'message: You need an <code>a</code> element that links to <code>http&#58;//freecatphotoapp<wbr>.com</code>');",
"assert(code.match(/<\\/a>/g) && code.match(/<\\/a>/g).length === code.match(/<a/g).length, 'message: Make sure your <code>a</code> element has a closing tag.');" "assert(code.match(/<\\/a>/g) && code.match(/<\\/a>/g).length === code.match(/<a/g).length, 'message: Make sure your <code>a</code> element has a closing tag.');"
], ],
"type": "waypoint", "type": "waypoint",
@ -1510,7 +1511,7 @@
"assert($(\"a\").text().match(/cat\\sphotos/gi), 'message: Your <code>a</code> element should have the anchor text of \"cat photos\"');", "assert($(\"a\").text().match(/cat\\sphotos/gi), 'message: Your <code>a</code> element should have the anchor text of \"cat photos\"');",
"assert($(\"p\") && $(\"p\").length > 2, 'message: Create a new <code>p</code> element around your <code>a</code> element.');", "assert($(\"p\") && $(\"p\").length > 2, 'message: Create a new <code>p</code> element around your <code>a</code> element.');",
"assert($(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().is(\"p\"), 'message: Your <code>a</code> element should be nested within your new <code>p</code> element.');", "assert($(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().is(\"p\"), 'message: Your <code>a</code> element should be nested within your new <code>p</code> element.');",
"assert($(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().text().match(/^\\s*View\\smore\\s/gi), 'message: Your <code>p</code> element should have the text \"View more \" (with a space after it).');", "assert($(\"a[href=\\\"http://www.freecatphotoapp.com\\\"]\").parent().text().match(/View\\smore\\s/gi), 'message: Your <code>p</code> element should have the text \"View more \" (with a space after it).');",
"assert(!$(\"a\").text().match(/View\\smore/gi), 'message: Your <code>a</code> element should <em>not</em> have the text \"View more\".');", "assert(!$(\"a\").text().match(/View\\smore/gi), 'message: Your <code>a</code> element should <em>not</em> have the text \"View more\".');",
"assert(code.match(/<\\/p>/g) && code.match(/<p/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, 'message: Make sure each of your <code>p</code> elements has a closing tag.');", "assert(code.match(/<\\/p>/g) && code.match(/<p/g) && code.match(/<\\/p>/g).length === code.match(/<p/g).length, 'message: Make sure each of your <code>p</code> elements has a closing tag.');",
"assert(code.match(/<\\/a>/g) && code.match(/<a/g) && code.match(/<\\/a>/g).length === code.match(/<a/g).length, 'message: Make sure each of your <code>a</code> elements has a closing tag.');" "assert(code.match(/<\\/a>/g) && code.match(/<a/g) && code.match(/<\\/a>/g).length === code.match(/<a/g).length, 'message: Make sure each of your <code>a</code> elements has a closing tag.');"

View File

@ -33,7 +33,7 @@
"MDNlinks": [ "MDNlinks": [
"Math.max()", "Math.max()",
"Math.min()", "Math.min()",
"Array.reduce()" "Array.prototype.reduce()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -82,10 +82,10 @@
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Comparison Operators", "Comparison Operators",
"Array.slice()", "Array.prototype.slice()",
"Array.filter()", "Array.prototype.filter()",
"Array.indexOf()", "Array.prototype.indexOf()",
"Array.concat()" "Array.prototype.concat()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -148,9 +148,9 @@
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Roman Numerals", "Roman Numerals",
"Array.splice()", "Array.prototype.splice()",
"Array.indexOf()", "Array.prototype.indexOf()",
"Array.join()" "Array.prototype.join()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -200,7 +200,7 @@
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Global Object", "Global Object",
"Object.hasOwnProperty()", "Object.prototype.hasOwnProperty()",
"Object.keys()" "Object.keys()"
], ],
"isRequired": true, "isRequired": true,
@ -248,9 +248,9 @@
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Array.splice()", "Array.prototype.splice()",
"String.replace()", "String.prototype.replace()",
"Array.join()" "Array.prototype.join()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -301,11 +301,11 @@
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Array.indexOf()", "Array.prototype.indexOf()",
"Array.push()", "Array.prototype.push()",
"Array.join()", "Array.prototype.join()",
"String.substr()", "String.prototype.substr()",
"String.split()" "String.prototype.split()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -352,8 +352,8 @@
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Array.push()", "Array.prototype.push()",
"String.split()" "String.prototype.split()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -499,7 +499,7 @@
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Arguments object", "Arguments object",
"Array.reduce()" "Array.prototype.reduce()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -551,7 +551,7 @@
"MDNlinks": [ "MDNlinks": [
"RegExp", "RegExp",
"HTML Entities", "HTML Entities",
"String.replace()" "String.prototype.replace()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -595,7 +595,7 @@
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"RegExp", "RegExp",
"String.replace()" "String.prototype.replace()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -685,7 +685,7 @@
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"For Loops", "For Loops",
"Array.push()" "Array.prototype.push()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -775,7 +775,7 @@
], ],
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Array.filter()" "Array.prototype.filter()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,
@ -821,8 +821,8 @@
"type": "bonfire", "type": "bonfire",
"MDNlinks": [ "MDNlinks": [
"Arguments object", "Arguments object",
"Array.shift()", "Array.prototype.shift()",
"Array.slice()" "Array.prototype.slice()"
], ],
"isRequired": true, "isRequired": true,
"challengeType": 5, "challengeType": 5,

View File

@ -45,8 +45,8 @@
], ],
"tests": [ "tests": [
"assert(code.match(/<\\/script\\s*>/g) && code.match(/<script(\\sasync|\\sdefer)*(\\s(charset|src|type)\\s*=\\s*[\"\\']+[^\"\\']*[\"\\']+)*(\\sasync|\\sdefer)*\\s*>/g) && code.match(/<\\/script\\s*>/g).length === code.match(/<script(\\sasync|\\sdefer)*(\\s(charset|src|type)\\s*=\\s*[\"\\']+[^\"\\']*[\"\\']+)*(\\sasync|\\sdefer)*\\s*>/g).length, 'message: Create a <code>script</code> element making sure it is valid and has a closing tag.');", "assert(code.match(/<\\/script\\s*>/g) && code.match(/<script(\\sasync|\\sdefer)*(\\s(charset|src|type)\\s*=\\s*[\"\\']+[^\"\\']*[\"\\']+)*(\\sasync|\\sdefer)*\\s*>/g) && code.match(/<\\/script\\s*>/g).length === code.match(/<script(\\sasync|\\sdefer)*(\\s(charset|src|type)\\s*=\\s*[\"\\']+[^\"\\']*[\"\\']+)*(\\sasync|\\sdefer)*\\s*>/g).length, 'message: Create a <code>script</code> element making sure it is valid and has a closing tag.');",
"assert(code.match(/\\$\\s*?\\(\\s*?document\\s*?\\)\\.ready\\s*?\\(\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/g), 'message: You should add <code>$&#40;document&#41;.ready&#40;function&#40;&#41; {</code> to the beginning of your <code>script</code> element.');", "assert(code.match(/\\$\\s*?\\(\\s*?document\\s*?\\)\\.ready\\s*?\\(\\s*?function\\s*?\\(\\s*?\\)\\s*?\\{/g), 'message: You should add <code>$&#40;document&#41;.ready<wbr>&#40;function&#40;&#41; {</code> to the beginning of your <code>script</code> element.');",
"assert(code.match(/\\n*?\\s*?\\}\\s*?\\);/g), 'message: Close your <code>$&#40;document&#41;.ready&#40;function&#40;&#41; {</code> function with <code>}&#41;;</code>');" "assert(code.match(/\\n*?\\s*?\\}\\s*?\\);/g), 'message: Close your <code>$&#40;document&#41;.ready<wbr>&#40;function&#40;&#41; {</code> function with <code>}&#41;;</code>');"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 0, "challengeType": 0,
@ -625,7 +625,7 @@
"jQuery has a function called <code>.html()</code> that lets you add HTML tags and text within an element. Any content previously within the element will be completely replaced with the content you provide using this function.", "jQuery has a function called <code>.html()</code> that lets you add HTML tags and text within an element. Any content previously within the element will be completely replaced with the content you provide using this function.",
"Here's how you would rewrite and emphasize the text of our heading:", "Here's how you would rewrite and emphasize the text of our heading:",
"<code>$(\"h3\").html(\"&#60;em&#62;jQuery Playground&#60;/em&#62;\");</code>", "<code>$(\"h3\").html(\"&#60;em&#62;jQuery Playground&#60;/em&#62;\");</code>",
"jQuery also has a similar function called <code>.text()</code> that only alters text without adding tags. In other words, this function will not evaluate any HTML tags passed to it, but will instead treat it as text you want to replace with.", "jQuery also has a similar function called <code>.text()</code> that only alters text without adding tags. In other words, this function will not evaluate any HTML tags passed to it, but will instead treat it as the text you want to replace the existing content with.",
"Change the button with id <code>target4</code> by emphasizing its text." "Change the button with id <code>target4</code> by emphasizing its text."
], ],
"releasedOn": "November 18, 2015", "releasedOn": "November 18, 2015",
@ -665,7 +665,8 @@
"assert.isTrue((/<em>#target4<\\/em>/gi).test($(\"#target4\").html()), 'message: Emphasize the text in your <code>target4</code> button by adding HTML tags.');", "assert.isTrue((/<em>#target4<\\/em>/gi).test($(\"#target4\").html()), 'message: Emphasize the text in your <code>target4</code> button by adding HTML tags.');",
"assert($(\"#target4\") && $(\"#target4\").text() === '#target4', 'message: Make sure the text is otherwise unchanged.');", "assert($(\"#target4\") && $(\"#target4\").text() === '#target4', 'message: Make sure the text is otherwise unchanged.');",
"assert.isFalse((/<em>/gi).test($(\"h3\").html()), 'message: Do not alter any other text.');", "assert.isFalse((/<em>/gi).test($(\"h3\").html()), 'message: Do not alter any other text.');",
"assert(code.match(/\\.html\\(/g), 'message: Make sure you are using <code>.html()</code> and not <code>.text()</code>.');" "assert(code.match(/\\.html\\(/g), 'message: Make sure you are using <code>.html()</code> and not <code>.text()</code>.');",
"assert(code.match(/\\$\\(\\s*?(\\\"|\\')#target4(\\\"|\\')\\s*?\\)\\.html\\(/), 'message: Make sure to select <code>button id=\"target4\"</code> with jQuery.');"
], ],
"type": "waypoint", "type": "waypoint",
"challengeType": 0, "challengeType": 0,

View File

@ -286,7 +286,7 @@
"id": "56bbb991ad1ed5201cd392d8", "id": "56bbb991ad1ed5201cd392d8",
"title": "Render Images from Data Sources", "title": "Render Images from Data Sources",
"description": [ "description": [
"We've seen from the last two lessons that each object in our JSON array contains an <code>imageLink</code> key with a value that is the url of a cat's image.", "We've seen from the last two lessons that each object in our JSON array contains an <code>imageLink</code> key with a value that is the URL of a cat's image.",
"When we're looping through these objects, let's use this <code>imageLink</code> property to display this image in an <code>img</code> element.", "When we're looping through these objects, let's use this <code>imageLink</code> property to display this image in an <code>img</code> element.",
"Here's the code that does this:", "Here's the code that does this:",
"<code>html += \"&lt;img src = '\" + val.imageLink + \"'&gt;\";</code>" "<code>html += \"&lt;img src = '\" + val.imageLink + \"'&gt;\";</code>"
@ -346,14 +346,14 @@
"challengeType": 0, "challengeType": 0,
"titleEs": "Presenta imágenes de fuentes de datos", "titleEs": "Presenta imágenes de fuentes de datos",
"descriptionEs": [ "descriptionEs": [
"Hemos visto en las dos últimas lecciones que cada objeto en nuestro vector JSON contiene una llave <code>imageLink</code> con un valor que corresponde a la url de la imagen de un gato.", "Hemos visto en las dos últimas lecciones que cada objeto en nuestro vector JSON contiene una llave <code>imageLink</code> con un valor que corresponde a la URL de la imagen de un gato.",
"Cuando estamos recorriendo estos objetos, usemos esta propiedad <code>imageLink</code> para visualizar la imagen en un elemento <code>img</code>.", "Cuando estamos recorriendo estos objetos, usemos esta propiedad <code>imageLink</code> para visualizar la imagen en un elemento <code>img</code>.",
"Aquí está el código que hace esto:", "Aquí está el código que hace esto:",
"<code>html += \"&lt;img src = '\" + val.imageLink + \"'&gt;\";</code>" "<code>html += \"&lt;img src = '\" + val.imageLink + \"'&gt;\";</code>"
], ],
"titlePt": "Apresentar as imagens da fonte de dados", "titlePt": "Apresentar as imagens da fonte de dados",
"descriptionPt": [ "descriptionPt": [
"Como temos visto nas ultimas lições, cada objeto em nosso array JSON contém a chave <code>imageLink</code> com um valor que corresponde a url da imagem de um gato.", "Como temos visto nas ultimas lições, cada objeto em nosso array JSON contém a chave <code>imageLink</code> com um valor que corresponde a URL da imagem de um gato.",
"Quando estamos percorrendo por estes objetos, usamos a propriedade <code>imageLink</code> para visualizar a imagem em um elemento <code>img</code>.", "Quando estamos percorrendo por estes objetos, usamos a propriedade <code>imageLink</code> para visualizar a imagem em um elemento <code>img</code>.",
"Aqui está o código para fazer isso:", "Aqui está o código para fazer isso:",
"<code>html += \"&lt;img src = '\" + val.imageLink + \"'&gt;\";</code>" "<code>html += \"&lt;img src = '\" + val.imageLink + \"'&gt;\";</code>"

View File

@ -319,7 +319,7 @@
"id": "bd7158d8c443edefaeb5bd0f", "id": "bd7158d8c443edefaeb5bd0f",
"title": "File Metadata Microservice", "title": "File Metadata Microservice",
"description": [ "description": [
"<strong>Objective:</strong> Build a full stack JavaScript app that is functionally similar to this: <a href='https://cryptic-ridge-9197.herokuapp.com/' target='_blank'>https://cryptic-ridge-9197.herokuapp.com/</a> and deploy it to Heroku.", "<strong>Objective:</strong> Build a full stack JavaScript app that is functionally similar to this: <a href='https://aryanj-file-size.herokuapp.com/' target='_blank'>https://aryanj-file-size.herokuapp.com/</a> and deploy it to Heroku.",
"Note that for each project, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit <a href='/challenges/get-set-for-our-back-end-development-projects'>https://freecodecamp.com/challenges/get-set-for-our-back-end-development-projects</a>.", "Note that for each project, you should create a new GitHub repository and a new Heroku project. If you can't remember how to do this, revisit <a href='/challenges/get-set-for-our-back-end-development-projects'>https://freecodecamp.com/challenges/get-set-for-our-back-end-development-projects</a>.",
"Here are the specific user stories you should implement for this project:", "Here are the specific user stories you should implement for this project:",
"<strong>User Story:</strong> I can submit a FormData object that includes a file upload.", "<strong>User Story:</strong> I can submit a FormData object that includes a file upload.",

View File

@ -30,9 +30,8 @@ block content
.btn-group.btn-group-justified .btn-group.btn-group-justified
.btn-group .btn-group
button.btn.btn-primary.btn-primary-ghost.btn-lg#trigger-reset-modal Reset button.btn.btn-primary.btn-primary-ghost.btn-lg#trigger-reset-modal Reset
a.btn.btn-primary.btn-primary-ghost.hidden-sm.hidden-md.hidden-lg(href='//gitter.im/freecodecamp/help') Help
.btn-group .btn-group
button.btn.btn-primary.btn-primary-ghost.hidden-xs.btn-lg#challenge-help-btn Help button.btn.btn-primary.btn-primary-ghost.btn-lg#challenge-help-btn Help
.btn-group .btn-group
button.btn.btn-primary.btn-primary-ghost.btn-lg#trigger-issue-modal Bug button.btn.btn-primary.btn-primary-ghost.btn-lg#trigger-issue-modal Bug
script. script.

View File

@ -9,7 +9,7 @@ block content
.big-break .big-break
.col-xs-12.col-sm-12.col-md-3 .col-xs-12.col-sm-12.col-md-3
img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_connect.svg', alt='Get great references and connections to start your software engineer career') img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_connect.svg', alt='Get great references and connections to start your software engineer career')
p.large-p Join a community of 300,000+ developers. p.large-p Join a community of 400,000+ developers.
.col-xs-12.col-sm-12.col-md-3 .col-xs-12.col-sm-12.col-md-3
img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_learn.svg', alt='Learn to code and learn full stack JavaScript') img.img-responsive.landing-icon.img-center(src= 'https://s3.amazonaws.com/freecodecamp/landingIcons_learn.svg', alt='Learn to code and learn full stack JavaScript')
p.large-p Work on coding challenges together. p.large-p Work on coding challenges together.

View File

@ -15,7 +15,7 @@ block content
| challenges | challenges
li.nowrap li.nowrap
span.tag Donated:&#9; span.tag Donated:&#9;
span.text-primary $850,000 span.text-primary $1,050,000
| in pro-bono code | in pro-bono code
li.nowrap li.nowrap
span.tag Pledged:&#9; span.tag Pledged:&#9;
@ -245,6 +245,6 @@ block content
td td
a(href='https://gitter.im/Rafase282' target='_blank') @Rafase282 a(href='https://gitter.im/Rafase282' target='_blank') @Rafase282
tr tr
td Campsites td Local groups
td td
a(href='https://gitter.im/Hallaathrad' target='_blank') @Hallaathrad a(href='https://gitter.im/Hallaathrad' target='_blank') @Hallaathrad