add new challenges
This commit is contained in:
committed by
Berkeley Martinez
parent
426ff2175f
commit
6f9fab3043
@ -0,0 +1,901 @@
|
||||
{
|
||||
"name": "Basic Algorithm Scripting",
|
||||
"order": 5,
|
||||
"time": "50 hours",
|
||||
"helpRoom": "HelpJavaScript",
|
||||
"challenges": [
|
||||
{
|
||||
"id": "bd7158d2c442eddfbeb5bd1f",
|
||||
"title": "Get Set for our Algorithm Challenges",
|
||||
"description": [
|
||||
[
|
||||
"//i.imgur.com/sJkp30a.png",
|
||||
"An image of a algorithm challenge showing directions, tests, and the code editor.",
|
||||
"Our algorithm challenges will teach you how to think like a programmer.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/d8LuRNh.png",
|
||||
"A mother bird kicks a baby bird out of her nest.",
|
||||
"Our previous challenges introduced you to programming concepts. But for these algorithm challenges, you'll now need to apply what you learned to solve open-ended problems.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/WBetuBa.jpg",
|
||||
"A programmer punching through his laptop screen in frustration.",
|
||||
"Our algorithm challenges are hard. Some of them may take you several hours to solve. You will get frustrated. But don't quit.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//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.<br>Don't worry - you've got this.",
|
||||
""
|
||||
]
|
||||
],
|
||||
"challengeSeed": [],
|
||||
"tests": [],
|
||||
"type": "Waypoint",
|
||||
"challengeType": 7,
|
||||
"isRequired": false,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Prepárate para nuestros Desafíos sobre Algoritmos",
|
||||
"description": [
|
||||
[
|
||||
"//i.imgur.com/sJkp30a.png",
|
||||
"Una imagen de un desafio sobre algoritmos que presenta instrucciones, pruebas y el editor de código.",
|
||||
"Nuestros desafios sobre algoritmos te enseñarán como pensar como un programador.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/d8LuRNh.png",
|
||||
"Una mamá pájaro saca un bebé pájaro fuer de su nido.",
|
||||
"Nuestros desafios anteriores te introdujeron a los conceptos de programación. Pero para estos desafios sobre algoritmos, ahora necesitarás aplicar lo que has aprendido y resolver problemas de respuesta abierta",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/WBetuBa.jpg",
|
||||
"Un programador frustado golpeando la pantalla de su computador.",
|
||||
"Nuestros desafíos sobre algortimos son difíciles. Algunos pueden requerir muchas horas para resolverse. Podrás frustarte, pero no te rindas.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/p2TpOQd.jpg",
|
||||
"Un tierno perro que salta sobre un obstáculo, pica el ojo y te apunta con su pata.",
|
||||
"Cuando te atasques, usa la metodología Leer-Buscar-Preguntar.<br>No te preocupes - ya lo has entendido.",
|
||||
""
|
||||
]
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Prepare-se para os Desafios de Algoritmos",
|
||||
"description": [
|
||||
[
|
||||
"//i.imgur.com/sJkp30a.png",
|
||||
"Uma imagem de um desagio de algoritmo mostrando direções, testes e o editor de código.",
|
||||
"Nossos desafios de algoritmos vão ensinar você como pensar como um programador.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/d8LuRNh.png",
|
||||
"Uma mãe pássaro chuta um bebê para fora do ninho.",
|
||||
"Nossos desafios anteriores introduziram você aos conceitos de programação. Mas para esses desafios de algoritmos, agora você vai precisar aplicar o que você aprendeu para resolver problemas abertos.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/WBetuBa.jpg",
|
||||
"Um programador atravessando a tela de seu laptop com um soco em frustração.",
|
||||
"Nossos desafios de algoritmos são difíceis. Alguns deles podem levar algumas horas para resolver. Você vai ficar frustrado. Mas não desista.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/p2TpOQd.jpg",
|
||||
"Um cachorro fofo pulando sobre um obstáculo, piscando e apontando sua pata à você.",
|
||||
"Quendo você ficar travado, use a metodoloia Ler-Pesquisar-Perguntar.<br>Não se preocupe - você consegue.",
|
||||
""
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a202eed8fc186c8434cb6d61",
|
||||
"title": "Reverse a String",
|
||||
"description": [
|
||||
"Reverse the provided string.",
|
||||
"You may need to turn the string into an array before you can reverse it.",
|
||||
"Your result must be a string.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function reverseString(str) {",
|
||||
" return str;",
|
||||
"}",
|
||||
"",
|
||||
"reverseString(\"hello\");"
|
||||
],
|
||||
"tests": [
|
||||
"assert(typeof reverseString(\"hello\") === \"string\", 'message: <code>reverseString(\"hello\")</code> should return a string.');",
|
||||
"assert(reverseString(\"hello\") === \"olleh\", 'message: <code>reverseString(\"hello\")</code> should become <code>\"olleh\"</code>.');",
|
||||
"assert(reverseString(\"Howdy\") === \"ydwoH\", 'message: <code>reverseString(\"Howdy\")</code> should become <code>\"ydwoH\"</code>.');",
|
||||
"assert(reverseString(\"Greetings from Earth\") === \"htraE morf sgniteerG\", 'message: <code>reverseString(\"Greetings from Earth\")</code> should return <code>\"htraE morf sgniteerG\"</code>.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"function reverseString(str) {\n return str.split('').reverse().join(\"\");\n}\n\nreverseString('hello');\n"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Global String Object",
|
||||
"String.prototype.split()",
|
||||
"Array.prototype.reverse()",
|
||||
"Array.prototype.join()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Invierte el texto",
|
||||
"description": [
|
||||
"Invierte la cadena de texto que se te provee",
|
||||
"Puede que necesites convertir la cadena de texto en un arreglo antes de que puedas invertirla",
|
||||
"El resultado debe ser una cadena de texto",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Inverter um texto",
|
||||
"description": [
|
||||
"Inverta o texto fornecido.",
|
||||
"Você pode precisar transformar o texto em uma matriz antes de poder invertê-lo.",
|
||||
"Seu resultado deve ser um texto.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a302f7aae1aa3152a5b413bc",
|
||||
"title": "Factorialize a Number",
|
||||
"description": [
|
||||
"Return the factorial of the provided integer.",
|
||||
"If the integer is represented with the letter n, a factorial is the product of all positive integers less than or equal to n.",
|
||||
"Factorials are often represented with the shorthand notation <code>n!</code>",
|
||||
"For example: <code>5! = 1 * 2 * 3 * 4 * 5 = 120</code>",
|
||||
"Only integers greater than or equal to zero will be supplied to the function.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function factorialize(num) {",
|
||||
" return num;",
|
||||
"}",
|
||||
"",
|
||||
"factorialize(5);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(typeof factorialize(5) === 'number', 'message: <code>factorialize(5)</code> should return a number.');",
|
||||
"assert(factorialize(5) === 120, 'message: <code>factorialize(5)</code> should return 120.');",
|
||||
"assert(factorialize(10) === 3628800, 'message: <code>factorialize(10)</code> should return 3628800.');",
|
||||
"assert(factorialize(20) === 2432902008176640000, 'message: <code>factorialize(20)</code> should return 2432902008176640000.');",
|
||||
"assert(factorialize(0) === 1, 'message: <code>factorialize(0)</code> should return 1.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"function factorialize(num) {\n return num < 1 ? 1 : num * factorialize(num-1);\n}\n\nfactorialize(5);\n"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Arithmetic Operators"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Factoriza un número",
|
||||
"description": [
|
||||
"Crea una función que devuelva el factorial del número entero que se te provee",
|
||||
"El factorial de un número entero positivo n es la multiplicación de todos los enteros positivos menores o iguales a n",
|
||||
"Los factoriales son comúnmente representados con la notación <code>n!</code>",
|
||||
"Por ejemplo: <code>5! = 1 * 2 * 3 * 4 * 5 = 120</code>",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Fatorial de um número",
|
||||
"description": [
|
||||
"Retorne o fatorial de um número inteiro fornecido.",
|
||||
"Se o inteiro é representado pela letra n, o fatorial é o produto de todos os inteiros positivos menores ou iguais a n.",
|
||||
"Fatoriais são comumente representados pela notação <code>n!</code>",
|
||||
"Por exemplo: <code>5! = 1 * 2 * 3 * 4 * 5 = 120</code>",
|
||||
"Apenas inteiros maior que ou iguais a zero serão fornecidos à função.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a26cbbe9ad8655a977e1ceb5",
|
||||
"title": "Find the Longest Word in a String",
|
||||
"description": [
|
||||
"Return the length of the longest word in the provided sentence.",
|
||||
"Your response should be a number.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function findLongestWord(str) {",
|
||||
" return str.length;",
|
||||
"}",
|
||||
"",
|
||||
"findLongestWord(\"The quick brown fox jumped over the lazy dog\");"
|
||||
],
|
||||
"tests": [
|
||||
"assert(typeof findLongestWord(\"The quick brown fox jumped over the lazy dog\") === \"number\", 'message: <code>findLongestWord(\"The quick brown fox jumped over the lazy dog\")</code> should return a number.');",
|
||||
"assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, 'message: <code>findLongestWord(\"The quick brown fox jumped over the lazy dog\")</code> should return 6.');",
|
||||
"assert(findLongestWord(\"May the force be with you\") === 5, 'message: <code>findLongestWord(\"May the force be with you\")</code> should return 5.');",
|
||||
"assert(findLongestWord(\"Google do a barrel roll\") === 6, 'message: <code>findLongestWord(\"Google do a barrel roll\")</code> should return 6.');",
|
||||
"assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, 'message: <code>findLongestWord(\"What is the average airspeed velocity of an unladen swallow\")</code> should return 8.');",
|
||||
"assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, 'message: <code>findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\")</code> should return 19.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"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": [
|
||||
"String.prototype.split()",
|
||||
"String.length"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Encuentra la palabra más larga",
|
||||
"description": [
|
||||
"Crea una función que devuelva la longitud de la palabra más larga en una frase dada",
|
||||
"El resultado debe ser un número",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Encontre a maior palavra num texto",
|
||||
"description": [
|
||||
"Retorne o tamanho da maior palavra na sentença fornecida.",
|
||||
"Sua resposta deve ser um número.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a789b3483989747d63b0e427",
|
||||
"title": "Return Largest Numbers in Arrays",
|
||||
"description": [
|
||||
"Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays.",
|
||||
"Remember, you can iterate through an array with a simple for loop, and access each member with array syntax <code>arr[i]</code>.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function largestOfFour(arr) {",
|
||||
" // You can do this!",
|
||||
" return arr;",
|
||||
"}",
|
||||
"",
|
||||
"largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]).constructor === Array, 'message: <code>largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return an array.');",
|
||||
"assert.deepEqual(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]), [27,5,39,1001], 'message: <code>largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]])</code> should return <code>[27,5,39,1001]</code>.');",
|
||||
"assert.deepEqual(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]), [9,35,97,1000000], 'message: <code>largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]])</code> should return <code>[9, 35, 97, 1000000]</code>.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"function largestOfFour(arr) {\n return arr.map(function(subArr) {\n return Math.max.apply(null, subArr);\n });\n}\n\nlargestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);\n"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Comparison Operators"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Devuelve el mayor entero de cada arreglo",
|
||||
"description": [
|
||||
"Crea una función que devuelva un arreglo que contenga el mayor de los números de cada sub-arreglo que recibe. Para simplificar las cosas, el arreglo que recibirá tendrá exactamente 4 sub-arreglos",
|
||||
"Recuerda que puedes iterar a través de un arreglo con un búcle simple, y acceder a cada miembro utilizando la sintaxis arr[i].",
|
||||
"Si escribes tu propio test con Chai.js, asegúrate de utilizar un operador de igualdad estricto en lugar de un operador de igualdad cuando compares arreglos. ",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Retorne os Maiores Números numa Matriz",
|
||||
"description": [
|
||||
"Retorne uma matriz que consiste no maior número de cada sub-matriz fornecida. Por simplicidade, a matriz fornecida conterá exatamente 4 sub-matrizes.",
|
||||
"Lembre-se, você pode iterar sobre uma matriz com um simples laço for, e acesar cara membro com a sintaxe <code>arr[i]</code>.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "acda2fb1324d9b0fa741e6b5",
|
||||
"title": "Confirm the Ending",
|
||||
"description": [
|
||||
"Check if a string (first argument, <code>str</code>) ends with the given target string (second argument, <code>target</code>).",
|
||||
"This challenge <em>can</em> be solved with the <code>.endsWith()</code> method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function confirmEnding(str, target) {",
|
||||
" // \"Never give up and good luck will find you.\"",
|
||||
" // -- Falcor",
|
||||
" return str;",
|
||||
"}",
|
||||
"",
|
||||
"confirmEnding(\"Bastian\", \"n\");"
|
||||
],
|
||||
"tests": [
|
||||
"assert(confirmEnding(\"Bastian\", \"n\") === true, 'message: <code>confirmEnding(\"Bastian\", \"n\")</code> should return true.');",
|
||||
"assert(confirmEnding(\"Connor\", \"n\") === false, 'message: <code>confirmEnding(\"Connor\", \"n\")</code> should return false.');",
|
||||
"assert(confirmEnding(\"Walking on water and developing software from a specification are easy if both are frozen\", \"specification\") === false, 'message: <code>confirmEnding(\"Walking on water and developing software from a specification are easy if both are frozen\", \"specification\")</code> should return false.');",
|
||||
"assert(confirmEnding(\"He has to give me a new name\", \"name\") === true, 'message: <code>confirmEnding(\"He has to give me a new name\", \"name\")</code> should return true.');",
|
||||
"assert(confirmEnding(\"Open sesame\", \"same\") === true, 'message: <code>confirmEnding(\"Open sesame\", \"same\")</code> should return true.');",
|
||||
"assert(confirmEnding(\"Open sesame\", \"pen\") === false, 'message: <code>confirmEnding(\"Open sesame\", \"pen\")</code> should return false.');",
|
||||
"assert(confirmEnding(\"Open sesame\", \"game\") === false, 'message: <code>confirmEnding(\"Open sesame\", \"game\")</code> should return false.');",
|
||||
"assert(confirmEnding(\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\") === false, 'message: <code>confirmEnding(\"If you want to save our world, you must hurry. We dont know how much longer we can withstand the nothing\", \"mountain\")</code> should return false.');",
|
||||
"assert(confirmEnding(\"Abstraction\", \"action\") === true, 'message: <code>confirmEnding(\"Abstraction\", \"action\")</code> should return true.');",
|
||||
"assert(!/\\.endsWith\\(.*?\\)\\s*?;?/.test(code), 'message: Do not use the built-in method <code>.endsWith()</code> to solve the challenge.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"function confirmEnding(str, target) {\n return str.substring(str.length-target.length) === target;\n};\n"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"String.prototype.substr()",
|
||||
"String.prototype.substring()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Confirma la terminación",
|
||||
"description": [
|
||||
"Verifica si una cadena de texto (primer argumento) termina con otra cadena de texto (segundo argumento).",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Confirme o Fim",
|
||||
"description": [
|
||||
"Confira se um texto (primeiro argumento, <code>str</code>) termina com um texto alvo (segundo argumento, <code>target</code>).",
|
||||
"Esse desafio <em>pode</em> ser resolvido com o método <code>.endsWith()</code>, que foi introduzido com o ES2015. Mas para o propósito deste desafio, nós gostaríamos que você usasse os métodos de substring do Javascript.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "afcc8d540bea9ea2669306b6",
|
||||
"title": "Repeat a String Repeat a String",
|
||||
"description": [
|
||||
"Repeat a given string <code>str</code> (first argument) for <code>num</code> times (second argument). Return an empty string if <code>num</code> is not a positive number.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function repeatStringNumTimes(str, num) {",
|
||||
" // repeat after me",
|
||||
" return str;",
|
||||
"}",
|
||||
"",
|
||||
"repeatStringNumTimes(\"abc\", 3);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(repeatStringNumTimes(\"*\", 3) === \"***\", 'message: <code>repeatStringNumTimes(\"*\", 3)</code> should return <code>\"***\"</code>.');",
|
||||
"assert(repeatStringNumTimes(\"abc\", 3) === \"abcabcabc\", 'message: <code>repeatStringNumTimes(\"abc\", 3)</code> should return <code>\"abcabcabc\"</code>.');",
|
||||
"assert(repeatStringNumTimes(\"abc\", 4) === \"abcabcabcabc\", 'message: <code>repeatStringNumTimes(\"abc\", 4)</code> should return <code>\"abcabcabcabc\"</code>.');",
|
||||
"assert(repeatStringNumTimes(\"abc\", 1) === \"abc\", 'message: <code>repeatStringNumTimes(\"abc\", 1)</code> should return <code>\"abc\"</code>.');",
|
||||
"assert(repeatStringNumTimes(\"*\", 8) === \"********\", 'message: <code>repeatStringNumTimes(\"*\", 8)</code> should return <code>\"********\"</code>.');",
|
||||
"assert(repeatStringNumTimes(\"abc\", -2) === \"\", 'message: <code>repeatStringNumTimes(\"abc\", -2)</code> should return <code>\"\"</code>.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"function repeatStringNumTimes(str, num) {\n if (num < 0) return '';\n return num === 1 ? str : str + repeatStringNumTimes(str, num-1);\n}\n\nrepeatStringNumTimes('abc', 3);\n"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Global String Object"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Repite el Texto Repite el Texto",
|
||||
"description": [
|
||||
"Repite una cadena de texto dada (primer argumento) <code>num</code> veces (segundo argumento). Retorna una cadena de texto vacía si <code>num</code> es un número negativo.",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Repita o Texto Repita o Texto",
|
||||
"description": [
|
||||
"Repita o texto dado <code>str</code> (primeiro argumento) <code>num</code> vezes (segundo argumento). Retorne um texto vazio se <code>num</code> não é for um número positivo.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ac6993d51946422351508a41",
|
||||
"title": "Truncate a String",
|
||||
"description": [
|
||||
"Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a <code>...</code> ending.",
|
||||
"Note that inserting the three dots to the end will add to the string length.",
|
||||
"However, if the given maximum string length <code>num</code> is less than or equal to 3, then the addition of the three dots does not add to the string length in determining the truncated string.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function truncateString(str, num) {",
|
||||
" // Clear out that junk in your trunk",
|
||||
" return str;",
|
||||
"}",
|
||||
"",
|
||||
"truncateString(\"A-tisket a-tasket A green and yellow basket\", 11);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(truncateString(\"A-tisket a-tasket A green and yellow basket\", 11) === \"A-tisket...\", 'message: <code>truncateString(\"A-tisket a-tasket A green and yellow basket\", 11)</code> should return \"A-tisket...\".');",
|
||||
"assert(truncateString(\"Peter Piper picked a peck of pickled peppers\", 14) === \"Peter Piper...\", 'message: <code>truncateString(\"Peter Piper picked a peck of pickled peppers\", 14)</code> should return \"Peter Piper...\".');",
|
||||
"assert(truncateString(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length) === \"A-tisket a-tasket A green and yellow basket\", 'message: <code>truncateString(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length)</code> should return \"A-tisket a-tasket A green and yellow basket\".');",
|
||||
"assert(truncateString('A-tisket a-tasket A green and yellow basket', 'A-tisket a-tasket A green and yellow basket'.length + 2) === 'A-tisket a-tasket A green and yellow basket', 'message: <code>truncateString(\"A-tisket a-tasket A green and yellow basket\", \"A-tisket a-tasket A green and yellow basket\".length + 2)</code> should return \"A-tisket a-tasket A green and yellow basket\".');",
|
||||
"assert(truncateString(\"A-\", 1) === \"A...\", 'message: <code>truncateString(\"A-\", 1)</code> should return \"A...\".');",
|
||||
"assert(truncateString(\"Absolutely Longer\", 2) === \"Ab...\", 'message: <code>truncateString(\"Absolutely Longer\", 2)</code> should return \"Ab...\".');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"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": [
|
||||
"String.prototype.slice()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Trunca una Cadena de Texto",
|
||||
"description": [
|
||||
"Trunca una cadena de texto (primer argumento) si su longitud es mayor que un máximo de caracteres dado (segundo argumento). Devuelve la cadena de texto truncada con una terminación \"...\".",
|
||||
"Ten en cuenta que los tres puntos al final también se cuentan dentro de la longitud de la cadena de texto.",
|
||||
"Si el <code>num</code es menor o igual a 3, entonces la longitud de los 3 puntos no se añade a la longitud de la cadena.",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Trunque um Texto",
|
||||
"description": [
|
||||
"Trunque um texto (primeiro argumento) se ela for mais longa que o comprimento máximo fornecido (segundo argumento). Retorne o texto truncada com <code>...</code> no final.",
|
||||
"Note que os três pontos inseridos no final vão ser adicionados ao tamanho do texto.",
|
||||
"Porém, se o tamanho máximo fornecido <code>num</code> for menor que ou igual a 3, então a adição dos três pontos não deve ser considerada no tamanho to texto truncada.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a6e40f1041b06c996f7b2406",
|
||||
"title": "Finders Keepers",
|
||||
"description": [
|
||||
"Create a function that looks through an array (first argument) and returns the first element in the array that passes a truth test (second argument). If no element passes the test, return undefined.",
|
||||
"Remember to use <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function findElement(arr, func) {",
|
||||
" var num = 0;",
|
||||
" return num;",
|
||||
"}",
|
||||
"",
|
||||
"findElement([1, 2, 3, 4], function(num){ return num % 2 === 0; });"
|
||||
],
|
||||
"solutions": [
|
||||
"function findElement(arr, func) {\n var num;\n arr.some(function(e) {\n if (func(e)) {\n num = e;\n return true;\n }\n });\n return num;\n}"
|
||||
],
|
||||
"tests": [
|
||||
"assert.strictEqual(findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; }), 8, 'message: <code>findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; })</code> should return 8.');",
|
||||
"assert.strictEqual(findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; }), undefined, 'message: <code>findElement([1, 3, 5, 9], function(num) { return num % 2 === 0; })</code> should return undefined.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"MDNlinks": [
|
||||
"Array.prototype.filter()"
|
||||
],
|
||||
"isRequired": true,
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Buscando la verdad",
|
||||
"description": [
|
||||
"Crea una función que busque dentro de un vector (primer argumento) y que devuelva el primer elemento que pase una prueba de verdad (segundo argumento).",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"fr": {
|
||||
"title": "Détecteur de mensonges",
|
||||
"description": [
|
||||
"Crée une fonction qui parcourt un tableau (premier argument) et renvoie le premier élément du tableau qui passe le test (second argument).",
|
||||
"N'oublie pas d'utiliser <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Lire-Chercher-Demander</a> si tu es bloqué. Essaye de trouver un partenaire. Écris ton propre code."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a77dbc43c33f39daa4429b4f",
|
||||
"title": "Boo who",
|
||||
"description": [
|
||||
"Check if a value is classified as a boolean primitive. Return true or false.",
|
||||
"Boolean primitives are true and false.",
|
||||
"Remember to use <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function booWho(bool) {",
|
||||
" // What is the new fad diet for ghost developers? The Boolean.",
|
||||
" return bool;",
|
||||
"}",
|
||||
"",
|
||||
"booWho(null);"
|
||||
],
|
||||
"solutions": [
|
||||
"function booWho(bool) {\n // What is the new fad diet for ghost developers? The Boolean.\n return typeof bool === \"boolean\";\n}\n\nbooWho(null);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.strictEqual(booWho(true), true, 'message: <code>booWho(true)</code> should return true.');",
|
||||
"assert.strictEqual(booWho(false), true, 'message: <code>booWho(false)</code> should return true.');",
|
||||
"assert.strictEqual(booWho([1, 2, 3]), false, 'message: <code>booWho([1, 2, 3])</code> should return false.');",
|
||||
"assert.strictEqual(booWho([].slice), false, 'message: <code>booWho([].slice)</code> should return false.');",
|
||||
"assert.strictEqual(booWho({ \"a\": 1 }), false, 'message: <code>booWho({ \"a\": 1 })</code> should return false.');",
|
||||
"assert.strictEqual(booWho(1), false, 'message: <code>booWho(1)</code> should return false.');",
|
||||
"assert.strictEqual(booWho(NaN), false, 'message: <code>booWho(NaN)</code> should return false.');",
|
||||
"assert.strictEqual(booWho(\"a\"), false, 'message: <code>booWho(\"a\")</code> should return false.');",
|
||||
"assert.strictEqual(booWho(\"true\"), false, 'message: <code>booWho(\"true\")</code> should return false.');",
|
||||
"assert.strictEqual(booWho(\"false\"), false, 'message: <code>booWho(\"false\")</code> should return false.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"MDNlinks": [
|
||||
"Boolean Objects"
|
||||
],
|
||||
"isRequired": true,
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "¡Bu!",
|
||||
"description": [
|
||||
"Crea una función que verifique si el valor que se le pasa es de tipo booleano. Haz que la función devuelva true o false según corresponda.",
|
||||
"Los primitivos booleanos primitivos son: true y false",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"fr": {
|
||||
"title": "Boo !",
|
||||
"description": [
|
||||
"Crée une fonction qui vérifie qu'une valeur est de type booléen. Renvoie true ou false.",
|
||||
"Les primitives booléennes sont true ou false.",
|
||||
"N'oublie pas d'utiliser <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Lire-Chercher-Demander</a> si tu es bloqué. Essaye de trouver un partenaire. Écris ton propre code."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ab6137d4e35944e21037b769",
|
||||
"title": "Title Case a Sentence",
|
||||
"description": [
|
||||
"Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.",
|
||||
"For the purpose of this exercise, you should also capitalize connecting words like \"the\" and \"of\".",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function titleCase(str) {",
|
||||
" return str;",
|
||||
"}",
|
||||
"",
|
||||
"titleCase(\"I'm a little tea pot\");"
|
||||
],
|
||||
"tests": [
|
||||
"assert(typeof titleCase(\"I'm a little tea pot\") === \"string\", 'message: <code>titleCase(\"I'm a little tea pot\")</code> should return a string.');",
|
||||
"assert(titleCase(\"I'm a little tea pot\") === \"I'm A Little Tea Pot\", 'message: <code>titleCase(\"I'm a little tea pot\")</code> should return \"I'm A Little Tea Pot\".');",
|
||||
"assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", 'message: <code>titleCase(\"sHoRt AnD sToUt\")</code> should return \"Short And Stout\".');",
|
||||
"assert(titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\") === \"Here Is My Handle Here Is My Spout\", 'message: <code>titleCase(\"HERE IS MY HANDLE HERE IS MY SPOUT\")</code> should return \"Here Is My Handle Here Is My Spout\".');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"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": [
|
||||
"String.prototype.split()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Aplica formato de título",
|
||||
"description": [
|
||||
"Crea una función que devuelva la cadena de texto que recibe con la primera letra de cada palabra en mayúscula. Asegúrate de que el resto de las letras sean minúsculas",
|
||||
"Para este ejercicio, también debes poner en mayúscula conectores como \"the\" y \"of\".",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Transforme o Texto em um Título",
|
||||
"description": [
|
||||
"Retorne o texto fornecido com a primeira letra de cada palavra em maiúsculo. Garanta que o resto da palavra esteja em formato minúsculo.",
|
||||
"Para o propósito deste exercício, você deve transformar também palavras conectivas como \"the\" e \"of\".",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "579e2a2c335b9d72dd32e05c",
|
||||
"title": "Slice and Splice",
|
||||
"description": [
|
||||
"You are given two arrays and an index.",
|
||||
"Use the array methods <code>slice</code> and <code>splice</code> to copy each element of the first array into the second array, in order.",
|
||||
"Begin inserting elements at index <code>n</code> of the second array.",
|
||||
"Return the resulting array. The input arrays should remain the same after the function runs.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function frankenSplice(arr1, arr2, n) {",
|
||||
" // It's alive. It's alive!",
|
||||
" return arr2;",
|
||||
"}",
|
||||
"",
|
||||
"frankenSplice([1, 2, 3], [4, 5, 6], 1);"
|
||||
],
|
||||
"tail": [
|
||||
"var testArr1 = [1, 2];",
|
||||
"var testArr2 = ['a', 'b'];"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], 'message: <code>frankenSplice([1, 2, 3], [4, 5], 1)</code> should return <code>[4, 1, 2, 3, 5]</code>.');",
|
||||
"assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ['a', 1, 2, 'b'], 'message: <code>frankenSplice([1, 2], [\"a\", \"b\"], 1)</code> should return <code>[\"a\", 1, 2, \"b\"]</code>.');",
|
||||
"assert.deepEqual(frankenSplice(['claw', 'tentacle'], ['head', 'shoulders', 'knees', 'toes'], 2), ['head', 'shoulders', 'claw', 'tentacle', 'knees', 'toes'], 'message: <code>frankenSplice([\"claw\", \"tentacle\"], [\"head\", \"shoulders\", \"knees\", \"toes\"], 2)</code> should return <code>[\"head\", \"shoulders\", \"claw\", \"tentacle\", \"knees\", \"toes\"]</code>.');",
|
||||
"assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4], 'message: All elements from the first array should be added to the second array in their original order.');",
|
||||
"assert(testArr1[0] === 1 && testArr1[1] === 2, 'message: The first array should remain the same after the function runs.');",
|
||||
"assert(testArr2[0] === 'a' && testArr2[1] === 'b', 'message: The second array should remain the same after the function runs.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"isBeta": true,
|
||||
"solutions": [
|
||||
"function frankenSplice(arr1, arr2, n) {\n // It's alive. It's alive!\n var result = arr2.slice();\n for(var i = 0; i < arr1.length; i++) {\n result.splice(n+i, 0, arr1[i]);\n }\n return result;\n}\n\nfrankenSplice([1, 2, 3], [4, 5], 1);\n"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Array.prototype.slice()",
|
||||
"Array.prototype.splice()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"pt-br": {
|
||||
"title": "Slice e Splice",
|
||||
"description": [
|
||||
"É dado a você duas matrizes e um índice.",
|
||||
"Use os métodos de matrizes <code>slice</code> e <code>splice</code> para copiar cada elemento da primeira matriz e colocar na segunda matriz, na ordem.",
|
||||
"Comece a inserir elementos no índice <code>n</code> da segunda matriz.",
|
||||
"Retorne a matriz resultante. As matrizes fornecidas devem permanecer inalteradas após a função ser executada.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "adf08ec01beb4f99fc7a68f2",
|
||||
"title": "Falsy Bouncer",
|
||||
"description": [
|
||||
"Remove all falsy values from an array.",
|
||||
"Falsy values in JavaScript are <code>false</code>, <code>null</code>, <code>0</code>, <code>\"\"</code>, <code>undefined</code>, and <code>NaN</code>.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function bouncer(arr) {",
|
||||
" // Don't show a false ID to this bouncer.",
|
||||
" return arr;",
|
||||
"}",
|
||||
"",
|
||||
"bouncer([7, \"ate\", \"\", false, 9]);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(bouncer([7, \"ate\", \"\", false, 9]), [7, \"ate\", 9], 'message: <code>bouncer([7, \"ate\", \"\", false, 9])</code> should return <code>[7, \"ate\", 9]</code>.');",
|
||||
"assert.deepEqual(bouncer([\"a\", \"b\", \"c\"]), [\"a\", \"b\", \"c\"], 'message: <code>bouncer([\"a\", \"b\", \"c\"])</code> should return <code>[\"a\", \"b\", \"c\"]</code>.');",
|
||||
"assert.deepEqual(bouncer([false, null, 0, NaN, undefined, \"\"]), [], 'message: <code>bouncer([false, null, 0, NaN, undefined, \"\"])</code> should return <code>[]</code>.');",
|
||||
"assert.deepEqual(bouncer([1, null, NaN, 2, undefined]), [1, 2], 'message: <code>bouncer([1, null, NaN, 2, undefined])</code> should return <code>[1, 2]</code>.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"function bouncer(arr) {\n // Don't show a false ID to this bouncer.\n return arr.filter(function(e) {return e;});\n}\n\nbouncer([7, 'ate', '', false, 9]);\n"
|
||||
],
|
||||
"MDNlinks": [
|
||||
"Boolean Objects",
|
||||
"Array.prototype.filter()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Detector de Mentiras",
|
||||
"description": [
|
||||
"Remueve todos los valores falsy de un arreglo dado",
|
||||
"En javascript, los valores falsy son los siguientes: <code>false</code>, <code>null</code>, <code>0</code>, <code>\"\"</code>, <code>undefined</code>, y <code>NaN</code>.",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Detector de Mentiras",
|
||||
"description": [
|
||||
"Remova todos os valores falsos de uma matriz.",
|
||||
"Valores falsos em JavaScript são <code>false</code>, <code>null</code>, <code>0</code>, <code>\"\"</code>, <code>undefined</code>, e <code>NaN</code>.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a24c1a4622e3c05097f71d67",
|
||||
"title": "Where do I Belong",
|
||||
"description": [
|
||||
"Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted. The returned value should be a number.",
|
||||
"For example, <code>getIndexToIns([1,2,3,4], 1.5)</code> should return <code>1</code> because it is greater than <code>1</code> (index 0), but less than <code>2</code> (index 1).",
|
||||
"Likewise, <code>getIndexToIns([20,3,5], 19)</code> should return <code>2</code> because once the array has been sorted it will look like <code>[3,5,20]</code> and <code>19</code> is less than <code>20</code> (index 2) and greater than <code>5</code> (index 1).",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function getIndexToIns(arr, num) {",
|
||||
" // Find my place in this sorted array.",
|
||||
" return num;",
|
||||
"}",
|
||||
"",
|
||||
"getIndexToIns([40, 60], 50);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(getIndexToIns([10, 20, 30, 40, 50], 35) === 3, 'message: <code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return <code>3</code>.');",
|
||||
"assert(getIndexToIns([10, 20, 30, 40, 50], 30) === 2, 'message: <code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return <code>2</code>.');",
|
||||
"assert(getIndexToIns([40, 60], 50) === 1, 'message: <code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.');",
|
||||
"assert(getIndexToIns([3, 10, 5], 3) === 0, 'message: <code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.');",
|
||||
"assert(getIndexToIns([5, 3, 20, 3], 5) === 2, 'message: <code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.');",
|
||||
"assert(getIndexToIns([2, 20, 10], 19) === 2, 'message: <code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.');",
|
||||
"assert(getIndexToIns([2, 5, 10], 15) === 3, 'message: <code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"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": [
|
||||
"Array.prototype.sort()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "¿Cuál es mi Asiento?",
|
||||
"description": [
|
||||
"Devuelve el menor índice en el que un valor (segundo argumento) debe ser insertado en un arreglo (primer argumento) una vez ha sido ordenado.",
|
||||
"Por ejemplo, where([1,2,3,4], 1.5) debe devolver 1 porque el segundo argumento de la función (1.5) es mayor que 1 (con índice 0 en el arreglo), pero menor que 2 (con índice 1).",
|
||||
"Mientras que <code>where([20,3,5], 19)</code> debe devolver <code>2</code> porque una vez ordenado el arreglo se verá com <code>[3,5,20]</code> y <code>19</code> es menor que <code>20</code> (índice 2) y mayor que <code>5</code> (índice 1).",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Qual o Meu Lugar?",
|
||||
"description": [
|
||||
"Retorne o menor índice que um valor (segundo argumento) deve ser inserido em uma matriz (primeiro argumento) uma vez que esta foi ordenada. O valor retornado deve ser um número.",
|
||||
"Por exemplo, <code>getIndexToIns([1,2,3,4], 1.5)</code> deve retornar <code>1</code> porque é maior do que <code>1</code> (índice 0), mas é menor que <code>2</code> (índice 1).",
|
||||
"Da mesma forma, <code>getIndexToIns([20,3,5], 19)</code> deve retornar <code>2</code> porque uma vez que a matriz foi ordenada ficará da seguinte forma <code>[3,5,20]</code> e <code>19</code> é menor que <code>20</code> (índice 2) e maior que <code>5</code> (índice 1).",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "af2170cad53daa0770fabdea",
|
||||
"title": "Mutations",
|
||||
"description": [
|
||||
"Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.",
|
||||
"For example, <code>[\"hello\", \"Hello\"]</code>, should return true because all of the letters in the second string are present in the first, ignoring case.",
|
||||
"The arguments <code>[\"hello\", \"hey\"]</code> should return false because the string \"hello\" does not contain a \"y\".",
|
||||
"Lastly, <code>[\"Alien\", \"line\"]</code>, should return true because all of the letters in \"line\" are present in \"Alien\".",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function mutation(arr) {",
|
||||
" return arr;",
|
||||
"}",
|
||||
"",
|
||||
"mutation([\"hello\", \"hey\"]);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(mutation([\"hello\", \"hey\"]) === false, 'message: <code>mutation([\"hello\", \"hey\"])</code> should return false.');",
|
||||
"assert(mutation([\"hello\", \"Hello\"]) === true, 'message: <code>mutation([\"hello\", \"Hello\"])</code> should return true.');",
|
||||
"assert(mutation([\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"]) === true, 'message: <code>mutation([\"zyxwvutsrqponmlkjihgfedcba\", \"qrstu\"])</code> should return true.');",
|
||||
"assert(mutation([\"Mary\", \"Army\"]) === true, 'message: <code>mutation([\"Mary\", \"Army\"])</code> should return true.');",
|
||||
"assert(mutation([\"Mary\", \"Aarmy\"]) === true, 'message: <code>mutation([\"Mary\", \"Aarmy\"])</code> should return true.');",
|
||||
"assert(mutation([\"Alien\", \"line\"]) === true, 'message: <code>mutation([\"Alien\", \"line\"])</code> should return true.');",
|
||||
"assert(mutation([\"floor\", \"for\"]) === true, 'message: <code>mutation([\"floor\", \"for\"])</code> should return true.');",
|
||||
"assert(mutation([\"hello\", \"neo\"]) === false, 'message: <code>mutation([\"hello\", \"neo\"])</code> should return false.');",
|
||||
"assert(mutation([\"voodoo\", \"no\"]) === false, 'message: <code>mutation([\"voodoo\", \"no\"])</code> should return false.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"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": [
|
||||
"String.prototype.indexOf()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Mutaciones",
|
||||
"description": [
|
||||
"Crea una función que devuelva <code>true</code> si la cadena de texto del primer elemento de un arreglo contiene todas las letras de la cadena de texto del segundo elemento del arreglo.",
|
||||
"Por ejemplo, <code>[\"hello\", \"Hello\"]</code>, debe devolver <code>true</code> porque todas las letras en la segunda cadena de texto están presentes en la primera, sin distinguir entre mayúsculas y minúsculas.",
|
||||
"En el caso de <code>[\"hello\", \"hey\"]</code> la función debe devolver false porque la cadena de texto \"hello\" no contiene una \"y\".",
|
||||
"Finalmente, <code>[\"Alien\", \"line\"]</code>, la función debe devolver <code>true</code> porque todas las letras en \"line\" están presentes en \"Alien\".",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Mutações",
|
||||
"description": [
|
||||
"Retorne verdadeiro se o texto no primeiro elemento da matriz contém todas as letras do texto no segundo elemento da matriz.",
|
||||
"Por exemplo, <code>[\"hello\", \"Hello\"]</code>, deve retornar verdadeiro pois todas as letras no segundo text estão presentes no primeiro texto.",
|
||||
"Os argumentos <code>[\"hello\", \"hey\"]</code> devem retornar falso por o texto \"hello\" não contém a letra \"y\".",
|
||||
"Por último, <code>[\"Alien\", \"line\"]</code>, deve retornar verdadeiro pois todas as letras em \"line\" estão presentes em \"Alien\".",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "a9bd25c716030ec90084d8a1",
|
||||
"title": "Chunky Monkey",
|
||||
"description": [
|
||||
"Write a function that splits an array (first argument) into groups the length of <code>size</code> (second argument) and returns them as a two-dimensional array.",
|
||||
"Remember to use <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function chunkArrayInGroups(arr, size) {",
|
||||
" // Break it up.",
|
||||
" return arr;",
|
||||
"}",
|
||||
"",
|
||||
"chunkArrayInGroups([\"a\", \"b\", \"c\", \"d\"], 2);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(chunkArrayInGroups([\"a\", \"b\", \"c\", \"d\"], 2), [[\"a\", \"b\"], [\"c\", \"d\"]], 'message: <code>chunkArrayInGroups([\"a\", \"b\", \"c\", \"d\"], 2)</code> should return <code>[[\"a\", \"b\"], [\"c\", \"d\"]]</code>.');",
|
||||
"assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3), [[0, 1, 2], [3, 4, 5]], 'message: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5]]</code>.');",
|
||||
"assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2), [[0, 1], [2, 3], [4, 5]], 'message: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5]]</code>.');",
|
||||
"assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4), [[0, 1, 2, 3], [4, 5]], 'message: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5]]</code>.');",
|
||||
"assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3), [[0, 1, 2], [3, 4, 5], [6]], 'message: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3)</code> should return <code>[[0, 1, 2], [3, 4, 5], [6]]</code>.');",
|
||||
"assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4), [[0, 1, 2, 3], [4, 5, 6, 7], [8]], 'message: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 4)</code> should return <code>[[0, 1, 2, 3], [4, 5, 6, 7], [8]]</code>.');",
|
||||
"assert.deepEqual(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2), [[0, 1], [2, 3], [4, 5], [6, 7], [8]], 'message: <code>chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2)</code> should return <code>[[0, 1], [2, 3], [4, 5], [6, 7], [8]]</code>.');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"isRequired": true,
|
||||
"solutions": [
|
||||
"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": [
|
||||
"Array.prototype.push()",
|
||||
"Array.prototype.slice()"
|
||||
],
|
||||
"challengeType": 5,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "En mil Pedazos",
|
||||
"description": [
|
||||
"Escribe una función que parta un arreglo (primer argumento) en fragmentos de una longitud dada (segundo argumento) y los devuelva en forma de un arreglo bidimensional.",
|
||||
"Recuerda utilizar <a href='http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514' target='_blank'>Leer-Buscar-Preguntar</a> si te sientes atascado. Intenta programar en pareja. Escribe tu propio código."
|
||||
]
|
||||
},
|
||||
"pt-br": {
|
||||
"title": "Em Pedaços",
|
||||
"description": [
|
||||
"Escreva uma funcção que divide uma matriz (primeiro argumento) em grupos de tamanho <code>size</code> (segundo argumento) e os retorna em uma matriz bidimensional.",
|
||||
"Lembre-se de usar <a href=\"http://forum.freecodecamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se você ficar travado. Escreva seu próprio código."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,737 @@
|
||||
{
|
||||
"name": "Debugging",
|
||||
"order": 4,
|
||||
"time": "1 hour",
|
||||
"helpRoom": "Help",
|
||||
"challenges": [
|
||||
{
|
||||
"id": "587d78b2367417b2b2512b0d",
|
||||
"title": "Introduction to the Debugging Challenges",
|
||||
"description": [
|
||||
[
|
||||
"http://imgs.xkcd.com/comics/debugging.png",
|
||||
"XKCD web comic walking through the convoluted process of debugging. The programmer moves from a browser problem, to a keyboard driver issue, receives a cryptic system utility error message, and ends by finding the sword of Martin the Warrior.",
|
||||
"Debugging is a valuable and (unfortunately) necessary tool for programmers. It follows the testing phase of checking if your code works as intended, and discovering it does not. Debugging is the process of finding exactly what isn't working and fixing it.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"",
|
||||
"",
|
||||
"After spending time creating a brilliant block of code, it is tough realizing it may have errors. These issues generally come in three forms: 1) syntax errors that prevent a program from running, 2) runtime errors when code fails to execute or has unexpected behavior, and 3) semantic (or logical) errors when code doesn't do what it's meant to.<br><br>Modern code editors (and experience) can help identify syntax errors. Semantic and runtime errors are harder to find. They may cause your program to crash, make it run forever, or give incorrect output. Think of debugging as trying to understand why your code is behaving the way it is.<br><br>Example of a syntax error - often detected by the code editor:<br><br><blockquote>funtion willNotWork( {<br> console.log(\"Yuck\");<br>}<br>// \"function\" keyword is misspelled and there's a missing parenthesis</blockquote><br><br>Here's an example of a runtime error - often detected while the program executes:<br><br><blockquote>function loopy() {<br> while(true) {<br> console.log(\"Hello, world!\");<br> }<br>}<br>// Calling loopy starts an infinite loop, which may crash your browser</blockquote><br><br>Example of a semantic error - often detected after testing code output:<br><br><blockquote>function calcAreaOfRect(w, h) {<br> return w + h; // This should be w * h<br>}<br>let myRectArea = calcAreaOfRect(2, 3);<br>// Correct syntax and the program executes, but this gives the wrong answer</blockquote>",
|
||||
""
|
||||
],
|
||||
[
|
||||
"",
|
||||
"",
|
||||
"Debugging is frustrating, but it helps to develop (and follow) a step-by-step approach to review your code. This means checking the intermediate values and types of variables to see if they are what they should be. You can start with a simple process of elimination.<br><br>For example, if function A works and returns what it's supposed to, then function B may have the issue. Or start checking values in a block of code from the middle to try to cut the search space in half. A problem in one spot indicates a bug in the first half of the code. If not, it's likely in the second.<br><br>This section will cover a couple helpful tools to find bugs, and some of the common forms they take. Fortunately, debugging is a learnable skill that just requires a little patience and practice to master.",
|
||||
""
|
||||
]
|
||||
],
|
||||
"releasedOn": "",
|
||||
"challengeSeed": [],
|
||||
"tests": [],
|
||||
"type": "Waypoint",
|
||||
"challengeType": 7,
|
||||
"isRequired": false,
|
||||
"titleEs": "",
|
||||
"descriptionEs": [
|
||||
[]
|
||||
],
|
||||
"titleFr": "",
|
||||
"descriptionFr": [
|
||||
[]
|
||||
],
|
||||
"titleDe": "",
|
||||
"descriptionDe": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "587d78b2367417b2b2512b0e",
|
||||
"title": "Add items to an array with push() and unshift()",
|
||||
"description": [
|
||||
"An array's length, like the data types it can contain, is not fixed. Arrays can be defined with a length of any number of elements, and elements can be added or removed over time. In this challenge, we will look at two methods with which we can programmatically modify an array: Array.push() and Array.unshift(). ",
|
||||
"Both methods take one or more elements as parameters and add those elements to the array the method is being called on; the push() method adds elements to the end of an array, and unshift() adds elements to the beginning. Consider the following:",
|
||||
"<code>let twentyThree = 'XXIII';</code>",
|
||||
"<code>let romanNumerals = ['XXI', 'XXII'];</code>",
|
||||
"<code>romanNumerals.unshift('XIX', 'XX'); </code>",
|
||||
"<code>// now equals ['XIX', 'XX', 'XXI', 'XXII']</code>",
|
||||
"<code>romanNumerals.push(twentyThree); </code>",
|
||||
"<code>// now equals ['XIX', 'XX', 'XXI', 'XXII', 'XXIII']</code>",
|
||||
"Notice that we can also pass variables, which allows us even greater flexibility in dynamically modifying our array's data.",
|
||||
"Instructions:",
|
||||
"We have defined a function, mixedNumbers, which we are passing an array as an argument. Modify the function by using push() and shift() to add 'I', 2, 'three', to the beginning of the array and 7, 'VIII', '9' to the end so that the returned array contains representations of the numbers 1-9 in order."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function mixedNumbers(arr) {",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
" return arr;",
|
||||
"}",
|
||||
"// do not change code below this line",
|
||||
"mixedNumbers(['IV', 5, 'six'])"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(mixedNumbers(['IV', 5, 'six']), ['I', 2, 'three', 'IV', 5, 'six', 7, 'VIII', '9'], \"<code>mixedNumbers(['IV', 5, 'six'])</code> should now return <code>['I', 2, 'three', 'IV', 5, 'six', 7, 'VIII', '9']</code>\");",
|
||||
"assert.notStrictEqual(mixedNumbers.toString().search(/\\.push\\(/), -1, 'The <code>mixedNumbers</code> function should utilize the <code>push()</code> method.);' ",
|
||||
"assert.notStrictEqual(mixedNumbers.toString().search(/\\.unshift\\(/), -1, \"The <code>mixedNumbers</code> function should utilize the <code>unshift()</code> method.\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d78b2367417b2b2512b0f",
|
||||
"title": "Remove items from an array with pop() and shift()",
|
||||
"description": [
|
||||
"Both push() and unshift() have corresponding methods that are nearly functional opposites: pop() and shift(). As you may have guessed by now, instead of adding, pop() removes an element from the end of an array, while shift() removes an element from the beginning. The key difference between pop() and shift() and their cousins push() and unshift(), is that neither method takes parameters, and each only allows an array to be modified by a single element at a time.",
|
||||
"Let's take a look:",
|
||||
"<code>let greetings = ['whats up?', 'hello', 'see ya!'];</code>",
|
||||
"<code>greetings.pop() </code>",
|
||||
"<code>// now equals ['whats up?', 'hello']</code>",
|
||||
"<code>greetings.shift() </code>",
|
||||
"<code>// now equals ['hello']</code>",
|
||||
"We can also return the value of the removed element with either method like this:",
|
||||
"<code>let popped = greetings.pop(); </code>",
|
||||
"<code>// returns 'hello'</code>",
|
||||
"<code>// greetings now equals []</code>",
|
||||
"Instructions",
|
||||
"We have defined a function, popShift, which takes an array as an argument and returns a new array. Modify the function, using pop() and shift(), to remove the first and last elements of the argument array, and assign the removed elements to their corresponding variables, so that the returned array contains their values."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function popShift(arr) {",
|
||||
" let popped = // change code here",
|
||||
" let shifted = // change code here",
|
||||
" return [shifted, popped];",
|
||||
"}",
|
||||
"// do not change code below this line",
|
||||
"popShift(['challenge', 'is', 'not', 'complete']);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(popShift(['challenge', 'is', 'not', 'complete']), ['challenge', 'complete'], \"<code>popShift(['challenge', 'is', 'not', 'complete'])</code> should return <code>['challenge', 'complete']</code>.\");",
|
||||
"assert.notStrictEqual(popShift.toString().search(/\\.pop\\(/), -1, \"The <code>popShift</code> function should utilize the <code>pop()</code> method.\");",
|
||||
"assert.notStrictEqual(popShift.toString().search(/\\.shift\\(/), -1, \"The <code>popShift</code> function should utilize the <code>shift()</code> method.\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d78b2367417b2b2512b10",
|
||||
"title": "Remove items using splice()",
|
||||
"description": [
|
||||
"Ok, so we've learned how to remove elements from the beginning and end of arrays using pop() and shift(), but what if we want to remove an element from somewhere in the middle? Or remove more than one element at once? Well, that's where splice() comes in. splice() allows us to do just that: remove any numnber of consecutive",
|
||||
"elements from anywhere on an array.",
|
||||
"splice() can take up to 3 parameters, but for now, we'll focus on just the first 2. The first two parameters of splice() are integers which represent indexes, or postions, of the array that splice() is being called upon. And remember, arrays are zero-indexed, so to indicate the first element of an array, we would use 0. splice()'s first parameter represents the index on the array from which to begin removing elements, while the second parameter indicates the number of elements to delete. For example:",
|
||||
"<code>let array = ['today', 'was', 'not', 'so', 'great'];</code>",
|
||||
"<code>array.splice(2, 2); </code>",
|
||||
"<code>// indicates that splice() should remove 2 elements beginning with the 3rd element</code>",
|
||||
"<code>// array now equals ['today', 'was', 'great']</code>",
|
||||
"splice() not only modifies the array it is being called on, but it also returns a new array containing the value of the removed elements. For example:",
|
||||
"<code>let array = ['today', 'was', 'not', 'so', 'great'];</code>",
|
||||
"<code>let newArray = array.splice(3, 2); </code>",
|
||||
"<code>// newArray equals ['so', 'great']</code>",
|
||||
"Instructions",
|
||||
"We've defined a function, sumOfTen, which takes an array as an argument and returns the sum of that array's elements. Modify the function, using splice(), so that it returns a value of 10."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function sumOfTen(arr) {",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
" return arr.reduce((a, b) => a + b);",
|
||||
"}",
|
||||
"// do not change code below this line",
|
||||
"sumOfTen([2, 5, 1, 5, 2, 1]);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.strictEqual(sumOfTen([2, 5, 1, 5, 2, 1]), 10, \"<code>sumOfTen</code> should return 10.\");",
|
||||
"assert.notStrictEqual(sumOfTen.toString().search(/\\.splice\\(/), -1, \"The <code>sumOfTen</code> function should utilize the <code>splice()</code> method.\")"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d78b3367417b2b2512b11",
|
||||
"title": "Add items using splice()",
|
||||
"description": [
|
||||
"Remember in the last challenge we mentioned that splice() can take up to three parameters? Well, we can go one step further with splice() — in addition to removing elements, we can use that third parameter, which represents one or more elements, to add them as well. This can be incredibly useful for quickly switching out an element, or a set of elements, for another. For instance, let's say you're storing a color scheme for a set of DOM elements in an array, and want to dynamically change a color based on some action:",
|
||||
"<code>function colorChange(arr, index, newColor) {</code>",
|
||||
"<code> arr.splice(index, 1, newColor);</code>",
|
||||
"<code> return arr;</code>",
|
||||
"<code>} </code>",
|
||||
"<code>let colorScheme = ['#878787', '#a08794', '#bb7e8c', '#c9b6be', '#d1becf'];</code>",
|
||||
"<code>colorScheme = colorChange(colorScheme, 2, \"#332327\");</code>",
|
||||
"<code>// we have removed '#bb7e8c' and added '#332327' in its place</code>",
|
||||
"<code>// colorScheme now equals ['#878787', '#a08794', '#332327', '#c9b6be', '#d1becf']</code>",
|
||||
"This function takes an array of hex values, an index at which to remove an element, and the new color to replace the removed element with. The return value is an array containing a newly modified color scheme! While this example is a bit oversimplified, we can see the value that utilizing splice() to its maximum potential can have.",
|
||||
"Instructions",
|
||||
"We have defined a function, htmlColorNames, which takes an array of html colors as an argument. Modify the function using splice() to remove the first two elements of the array and add 'DarkSalmon' and 'BlanchedAlmond' in their respective places."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function htmlColorNames(arr) {",
|
||||
" // change code below this line",
|
||||
" ",
|
||||
" // change code above this line",
|
||||
" return arr;",
|
||||
"} ",
|
||||
"// do not change code below this line",
|
||||
"htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurqoise', 'FireBrick']);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(htmlColorNames(['DarkGoldenRod', 'WhiteSmoke', 'LavenderBlush', 'PaleTurqoise', 'FireBrick']), ['DarkSalmon', 'BlanchedAlmond', 'LavenderBlush', 'PaleTurqoise', 'FireBrick'], \"<code>htmlColorNames</code> should return ['DarkSalmon', 'BlanchedAlmond', 'LavenderBlush', 'PaleTurqoise', 'FireBrick']\");",
|
||||
"assert.notStrictEqual(htmlColorNames.toString().search(/\\.splice\\(/), -1, \"The <code>htmlColorNames</code> function should utilize the <code>splice()</code> method.\")"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7a367417b2b2512b12",
|
||||
"title": "Copy an array with slice()",
|
||||
"description": [
|
||||
"The next method we will cover is slice(). slice(), rather than modifying an array, copies, or extracts, a given mumber of elements to a new array, leaving the array it is called upon untouched. slice() takes only 2 parameters — the first is the index at which to begin extraction, and the second is the index at which to stop extraction (extraction will occur up to, but not including the element at this index). Consider this:",
|
||||
"<code>let weatherConditions = ['rain', 'snow', 'sleet', 'hail', 'clear'];</code>",
|
||||
"<code>let todaysWeather = weatherConditions.slice(1, 3);</code>",
|
||||
"<code>// todaysWeather equals ['snow', 'sleet'];</code>",
|
||||
"<code>// weatherConditions still equals ['rain', 'snow', 'sleet', 'hail', 'clear']</code>",
|
||||
"In effect, we have created a new array by extracting elements from an existing array.",
|
||||
"Instructions",
|
||||
"Instructions: We have defined a function, forecast, that takes an array as an argument. Modify the function using slice() to extract information from the argument array and return a new array that contains the elements 'warm' and 'sunny'."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function forecast(arr) {",
|
||||
" // change code below this line",
|
||||
" ",
|
||||
" return arr;",
|
||||
"}",
|
||||
"// do not change code below this line",
|
||||
"forecast(['cold', 'rainy', 'warm', 'sunny', 'cool', 'thunderstorms']);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(forecast(['cold', 'rainy', 'warm', 'sunny', 'cool', 'thunderstorms']), ['warm', 'sunny'], \"<code>forecast</code> should return <code>['warm', 'sunny'].\");",
|
||||
"assert.notStrictEqual(forecast.toString().search(/\\.slice\\(/), -1, \"The <code>forecast</code> function should utilize the <code>slice()</code> method.\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7b367417b2b2512b13",
|
||||
"title": "Copy an array with spread syntax",
|
||||
"description": [
|
||||
"While slice() allows us to be selective about what elements of an array to copy, ammong several other useful tasks, ES6's new spread syntax allows us to easily copy all of an array's elements, in order, with a simple and highly readable syntax. The spread syntax simply looks like this: ...",
|
||||
"In practice, we can use the spread syntax to copy an array like so:",
|
||||
"<code>let thisArray = [true, true, undefined, false, null];</code>",
|
||||
"<code>let thatArray = [...thisArray];</code>",
|
||||
"<code>// thatArray equals [true, true, undefined, false, null]</code>",
|
||||
"<code>// thisArray remains unchanged, and is identical to thatArray</code>",
|
||||
"Instructions",
|
||||
"We have defined a function, copyMachine which takes arr (an array) and num (a number) as arguments. The function is supposed to return a new array made up of num copies of arr. We have done most of the work for you, but it doesn't work quite right yet. Modidy the function using the spead syntax so that it works correctly (hint: another method we have already covered might come in handy here!)."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function copyMachine(arr, num) {",
|
||||
" let newArr = [];",
|
||||
" while (num >= 1) {",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
" num--;",
|
||||
" }",
|
||||
" return newArr;",
|
||||
"}",
|
||||
"copyMachine([true, false, true], 2);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(copyMachine([true, false, true], 2), [[true, false, true], [true, false, true]], \"<code>copyMachine([true, false, true], 2)</code> should return <code>[[true, false, true], [true, false, true]]</code>.\")",
|
||||
"assert.deepEqual(copyMachine([1, 2, 3], 5), [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]], \"<code>copyMachine([1, 2, 3], 5)</code> should return <code>[[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]]</code>.\");",
|
||||
"assert.deepEqual(copyMachine([true, true, null], 1), [[true, true, null]], \"<code>copyMachine([true, true, null], 1)</code> should return <code>[[true, true, null]]</code>.\");",
|
||||
"assert.deepEqual(copyMachine(['it works'], 3), [['it works'], ['it works'], ['it works']], \"<code>copyMachine(['it works'], 3)</code> should return <code>[['it works'], ['it works'], ['it works']]</code>.\");",
|
||||
"assert.notStrictEqual(copyMachine.toString().search(/\\.\\.\\./), -1, \"The <code>copyMachine</code> function should utilize the <code>...</code> syntax.\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7b367417b2b2512b14",
|
||||
"title": "Check for the presence of an element with indexOf()",
|
||||
"description": [
|
||||
"Since arrays can be changed, or mutated, at any time, there's no guarantee about where a particular piece of data will be on a given array, or if that element even still exists. Luckily, JavaScript provides us with another built-in method, indexOf(), that allows us to quickly and easily check for the presence of an element on an array. indexOf() takes an element as a parameter, and when called, it returns the position, or index, of that element, or -1 if the element does not exist on the array.",
|
||||
"For example:",
|
||||
"<code>let fruits = ['apples', 'pears', 'oranges', 'peaches', 'pears'];</code>",
|
||||
"<code>fruits.indexOf('dates') // returns -1</code>",
|
||||
"<code>fruits.indexOf('oranges') // returns 2</code>",
|
||||
"<code>fruits.indexOf('pears') // returns 1, the first index at which the element exists</code>",
|
||||
"Instructions",
|
||||
"indexOf() can be incredibly useful for quickly checking for the presence of an element on an array. We have defined a function, quickCheck, that takes an array and an element as arguments. Modify the function using indexOf() so that it returns true if the passed element exists on the array, and false if it does not."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function quickCheck(arr, elem) {",
|
||||
" if (arr.indexOf(elem) !== -1) {",
|
||||
" return true",
|
||||
" } else {",
|
||||
" return false;",
|
||||
" }",
|
||||
"}"
|
||||
],
|
||||
"tests": [
|
||||
"assert.strictEqual(quickCheck(['squash', 'onions', 'shallots'], 'mushrooms'), false, \"<code>quickCheck(['squash', 'onions', 'shallots'], 'mushrooms')</code> should return <code>false</code>.\");",
|
||||
"assert.strictEqual(quickCheck(['squash', 'onions', 'shallots'], 'onions'), true, \"<code>quickCheck(['squash', 'onions', 'shallots'], 'onions')</code> should return <code>true</code>.\");",
|
||||
"assert.strictEqual(quickCheck([3, 5, 9, 125, 45, 2], 125), true, \"<code>quickCheck([3, 5, 9, 125, 45, 2], 125)</code> should return <code>true</code>.\");",
|
||||
"assert.strictEqual(quickCheck([true, false, false], undefined), false, \"<code>quickCheck([true, false, false], undefined)</code> should return <code>false</code>.\");",
|
||||
"assert.notStrictEqual(quickCheck.toString().search(/\\.indexOf\\(/), -1, \"The <code>quickCheck</code> function should utilize the <code>indexOf() method.</code>\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7b367417b2b2512b15",
|
||||
"title": "Iterate through all the items in an array",
|
||||
"description": [
|
||||
"Sometimes when working with arrays, it is very handy to be able to iterate through each item to find one or more elements that we might need, or to manipulate an array based on which data items meet a certain set of requirements. JavaScript offers several built in methods that each iterate over arrays in slightly different ways to achieve different results (such as every(), forEach(), map(), etc.), however the technique which is most flexible and offers us the greatest amount of control is a simple for loop.",
|
||||
"For example:",
|
||||
"<code>function greaterThanTen(arr) {</code>",
|
||||
"<code> let newArr = [];</code>",
|
||||
"<code> for (let i = 0; i < arr.length; i++) {</code>",
|
||||
"<code> if (arr[i] > 10) {</code>",
|
||||
"<code> newArr.push(arr[i]);</code>",
|
||||
"<code> }</code>",
|
||||
"<code> }</code>",
|
||||
"<code> return newArr</code>",
|
||||
"<code>}</code>",
|
||||
"<code>greaterThanTen([2, 12, 8, 14, 80, 0, 1]);</code>",
|
||||
"<code>// returns [12, 14, 80]</code>",
|
||||
"Using a for loop, this function iterates through and accesses each element of the array, and subjects it to a simple test that we have created. In this way, we have easily and programmatically determined which data items are greater than 10, and returned a new array containing those items.",
|
||||
"Instructions",
|
||||
"We have defined a function, filteredArray, which takes arr, a nested array, and elem as arguments, and returns a new array. elem represents an element that may or may not be present on one or more of the arrays nested within arr. Modify the function, using a for loop, to return a filtered version of the passed array such that any array nested within arr containing elem has been removed."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function filteredArray(arr, num) {",
|
||||
" newArr = [];",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
" return newArr;",
|
||||
"}",
|
||||
"filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3);"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(filteredArray([ [10, 8, 3], [14, 6, 23], [3, 18, 6] ], 18), [[10, 8, 3], [14, 6, 23]], \"<code>filteredArray([[10, 8, 3], [14, 6, 23], [3, 18, 6]], 18)</code> should return <code>[[10, 8, 3], [14, 6, 23]]</code>\");",
|
||||
"assert.deepEqual(filteredArray([ ['trumpets', 2], ['flutes', 4], ['saxaphones', 2] ], 2), [['flutes', 4]], \"<code>filteredArray([['trumpets', 2], ['flutes', 4], ['saxaphones'], 2], 2)</code> should return <code>[['flutes', 4]]</code>\");",
|
||||
"assert.deepEqual(filteredArray([['amy', 'beth', 'sam'], ['dave', 'sean', 'peter']], 'peter'), [['amy', 'beth', 'sam']], \"<code>filteredArray([['amy', 'beth', 'sam'], ['dave', 'sean', 'peter']], 'peter')</code> should return [['amy', 'beth', 'sam']].\");",
|
||||
"assert.deepEqual(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3), [], \"<code>filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3)</code> should return <code>[]</code>.\");",
|
||||
"assert.notStrictEqual(filteredArray.toString().search(/for/), -1, \"The <code>filteredArray</code> function should utilize a <code>for</code> loop.\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7b367417b2b2512b16",
|
||||
"title": "Create complex nested arrays",
|
||||
"description": [
|
||||
"One of the most powerful features when thinking of arrays as data structures, is that arrays can contain, or even be completely made up of other arrays. We have seen arrays that contain arrays in previous challenges, but fairly simple ones. However, arrays can contain an infinite depth of arrays that can contain other arrays, each with their own arbitrary levels of depth, and so on. In this way, an array can very quickly become very complex data structure, Consider the following example:",
|
||||
"<code>let nestedArray = [ // top, or first level - the outer most array</code>",
|
||||
"<code> ['deep'], // an array within an array, 2 levels of depth</code>",
|
||||
"<code> [ </code>",
|
||||
"<code> ['deeper'], ['deeper'] // 2 arrays nested 3 levels deep</code>",
|
||||
"<code> ], </code>",
|
||||
"<code> [ </code>",
|
||||
"<code> [ </code>",
|
||||
"<code> ['deepest'], ['deepest'] // 2 arrays nested 4 levels deep </code>",
|
||||
"<code> ], </code>",
|
||||
"<code> [ </code>",
|
||||
"<code> [</code>",
|
||||
"<code> ['deepest-est?'] // an array nested 5 levels deep</code>",
|
||||
"<code> ] </code>",
|
||||
"<code> ]</code>",
|
||||
"<code> ], </code>",
|
||||
"<code>];</code>",
|
||||
"While this example may seem convoluted, this level of complexity is not unheard of, or even unusual, when dealing with large amounts of data.",
|
||||
"However, we can still very easily access the deepest levels of an array this complex with bracket notation:",
|
||||
"<code>console.log(nestedArray[2][1][0][0][0]);</code>",
|
||||
"<code>// logs 'deepest-est?'</code>",
|
||||
"And now that we know where that piece of data is, we can reset it if we need to:",
|
||||
"<code>nestedArray[2][1][0][0][0] = 'deeper still';</code>",
|
||||
"<code>console.log(nestedArray[2][1][0][0][0]);</code>",
|
||||
"<code>// now logs 'deeper still'</code>",
|
||||
"Instructions",
|
||||
"We have defined a variable, myNestedArray, set equal to an array. Modify myNestedArray, using any combination of strings, numbers, and booleans for data elements, so that it has exactly three levels of depth (remember, the outer-most array is level 1)."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let myNestedArray = [",
|
||||
" ",
|
||||
" // change code here",
|
||||
" ",
|
||||
"];"
|
||||
],
|
||||
"tests": [
|
||||
"assert.strictEqual((function(arr) { let flattened = (function flatten(arr) { const flat = [].concat(...arr); return flat.some (Array.isArray) ? flatten(flat) : flat; })(arr); for (let i = 0; i < flattened.length; i++) { if ( typeof flattened[i] !== 'number' && typeof flattened[i] !== 'string' && typeof flattened[i] !== 'boolean') { return false } } return true })(myNestedArray), true, \"<code>myNestedArray</code> should contain only numbers, booleans, and strings as data elements.\");",
|
||||
"assert((function(arr) { for (let i = 0; i < arr.length; i++) { if (Array.isArray(arr[i])) {for (let j = 0; j < arr[i].length; j++) { if (Array.isArray(arr[i][j])) { return true } } } } })(myNestedArray) === true && (function(arr) { for (let i = 0; i < arr.length; i++) { for (let j = 0; j < arr[i].length; j++) { for (let k = 0; k < arr[i][j].length; k++) { if ( Array.isArray(arr[i][j][k]) ) { return false } } } } })(myNestedArray) === undefined, \"<code>myNestedArray</code> should have exactly 3 levels of depth.\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7b367417b2b2512b17",
|
||||
"title": "Combining arrays with spread syntax",
|
||||
"description": [
|
||||
"Another huge advantage of the spread syntax, is the ability to combine arrays, or to insert all the elements of one array into another, at any index. With more traditional syntaxes, we can concatenate arrays, but this only allows us to combine arrays at the end of one, and at the start of another. Spread syntax makes the following operation extremely simple:",
|
||||
"<code>let thisArray = ['sage', 'rosemary', 'parsely', 'thyme'];</code>",
|
||||
"<code>let thatArray = ['basil', 'cilantro', ...thisArray, 'corriander'];</code>",
|
||||
"<code>// thatArray now equals ['basil', 'cilantro', 'sage', 'rosemary', 'parsely', 'thyme', 'corriander']</code>",
|
||||
"Using spread syntax, we have just achieved an operation that would have been more more complex and more verbose had we used traditional methods.",
|
||||
"Instructions",
|
||||
"We have defined a function spreadOut that returns the variable sentence, modify the function using the spread syntax so that it returns the array ['learning', 'to', 'code', 'is', 'fun']."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function spreadOut() {",
|
||||
" let fragment = ['to', 'code'];",
|
||||
" let sentence = 'change code here'",
|
||||
" return sentence;",
|
||||
"}",
|
||||
"spreadOut();"
|
||||
],
|
||||
"tests": [
|
||||
"assert.deepEqual(spreadOut(), ['learning', 'to', 'code', 'is', 'fun'], \"<code>spreadOut</code> should return <code>['learning', 'to', 'code', 'is', 'fun']</code>.\");",
|
||||
"assert.notStrictEqual(spreadOut.toString().search(/\\.\\.\\./), -1, \"The <code>spreadOut</code> function should utilize the spread syntax.\");"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7c367417b2b2512b18",
|
||||
"title": "Add Key-Value Pairs to JavaScript Objects",
|
||||
"description": [
|
||||
"The next data structure we will discuss is the JavaScript object. Objects are a very fundamental part of JavaScript, in fact, you may have heard this line before: 'In JavaScript, everything is an object.' While an understanding of objects is important to understand the inner workings of JavaScript functions or JavaScript's object-oriented capabilities, JavaScript objects at a basic level are actually just key-value pair stores, a commonly used data structure. Here, we will confine our discussion to JavaScript objects in this capacity.",
|
||||
"Key-value pair data structure go by different names depending on the language you are using and the specific details of the data structure. The terms dictionary, map, and hash table all refer to the notion of a data structure in which specific keys, or properties are mapped to specific values. For instance, consider the following:",
|
||||
"<code>let FCC_User = {</code>",
|
||||
"<code> username: 'awesome_coder',</code>",
|
||||
"<code> followers: 572,</code>",
|
||||
"<code> points: 1741,</code>",
|
||||
"<code> completedProjects: 15</code>",
|
||||
"<code>};</code>",
|
||||
"We've just defined an object called FCC_User with four properties each of which map to a specific value. If you wanted to know the number of followers FCC_User has, you could access that property by writing FCC_User.followers — this is called dot notation. You could also access the property with brackets, like so: FCC_User['followers']. Notice with the bracket notation we enclosed followers in quotes. This is because the brackets actually allow us to pass a variable in to be evaluated as a property name. Keep this in mind for later.",
|
||||
"Instructions: We've created a foods object here with three entries. Add three more entries: bananas with a value of 13, grapes with a value of 35, and strawberries with a value of 27."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let foods = {",
|
||||
" apples: 25,",
|
||||
" oranges: 32,",
|
||||
" plums: 28",
|
||||
"};",
|
||||
"// change code below this line"
|
||||
],
|
||||
"tests": [
|
||||
"assert(typeof foods === 'object', 'foods is an object');",
|
||||
"assert(foods.bananas === 13, 'The foods object has a key \\'bananas\\' with a value of 13.');",
|
||||
"assert(foods.grapes === 35, 'The foods object has a key \\'grapes\\' with a value of 35.');",
|
||||
"assert(foods.strawberries === 27, 'The foods object has a key \\'strawberries\\' with a value of 27.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7c367417b2b2512b19",
|
||||
"title": "",
|
||||
"description": [
|
||||
"Objects, and other similar key-value pair data structures, offer some very useful benefits. One clear benefit is that they allow us to structure our data in an intuitive way. They are also very flexible. For instance, you can have properties nested to an arbitrary depth. Values can also be anything, for example a key can store an array, or even another object. Objects are also the foundation for JavaScript Object Notation, JSON, which is a widely used method of sending data across the web.",
|
||||
"Another powerful advantage of key-value pair data structures is constant lookup time. What we mean by this is when you request the value of a specific property you will get the value back in the same amount of time (theoretically) regardless of the number of entries in the object. If you had an object with 5 entries or one that held a collection of 1,000,000 entries you could still retrieve property values or check if a key exists in the same amount of time.",
|
||||
"The reason for this fast lookup time is that internally the object is storing properties using some type of hashing mechanism which allows it to know exactly where it has stored different property values. If you want to learn more about this please take a look at the optional Advanced Data Structures challenges. All you should remember for now is that performant access to flexibly structured data make key-value stores very attractive data structures useful in a wide variety of settings.",
|
||||
"Instructions: Here we've written an object nestedObject which includes another object nested within it. You can modify properties on this nested object in the same way you modified properties in the last challenge. Set the value of the online key to 45."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let nestedObject = {",
|
||||
" id: 23894201352,",
|
||||
" date: 'January 1, 2017',",
|
||||
" data: {",
|
||||
" totalUsers: 51,",
|
||||
" online: 42",
|
||||
" }",
|
||||
"};",
|
||||
"// change code below this line"
|
||||
],
|
||||
"tests": [
|
||||
"assert('id' in nestedObject && 'date' in nestedObject && 'data' in nestedObject, 'nestedObject has id, date and data properties.');",
|
||||
"assert('totalUsers' in nestedObject.data && 'online' in nestedObject.data, 'nestedObject has a data key set to an object with keys totalUsers and online.');",
|
||||
"assert(nestedObject.data.online === 45, 'The online property nested in the data key of nestedObject should be set to 45.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7c367417b2b2512b1a",
|
||||
"title": " Access Property Names with Bracket Notation",
|
||||
"description": [
|
||||
"In the first challenge we mentioned the use of bracket notation as a way access properties values using the evaluation of a variable. For instance, if you recall our foods object from that challenge, imagine that this object is being used in a program for a supermarket cash register. We have some function that sets the selectedFood and we want to check our foods object for the presence of that food. This might look like:",
|
||||
"<code>let selectedFood = getCurrentFood(scannedItem);</code>",
|
||||
"<code>let inventory = foods[selectedFood];</code>",
|
||||
"This code will evaluate the value stored in the selectedFood variable and return the value of that key in the foods object, or undefined if it is not present. Bracket notation is very useful because sometime object properties are not known before runtime or we need to access them in a more dynamic way.",
|
||||
"Instructions: In the example code we've defined a function checkInventory which receives a scanned item as an argument. Return the current value of the scannedItem key in the foods object. You can assume that only valid keys will be provided as an argument to checkInventory."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let foods = {",
|
||||
" apples: 25,",
|
||||
" oranges: 32,",
|
||||
" plums: 28,",
|
||||
" bananas: 13,",
|
||||
" grapes: 35,",
|
||||
" strawberries: 27",
|
||||
"};",
|
||||
"function checkInventory(scannedItem) {",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
"};"
|
||||
],
|
||||
"tests": [
|
||||
"assert(typeof checkInventory === 'function', 'checkInventory is a function');",
|
||||
"assert('apples' in foods && 'oranges' in foods && 'plums' in foods && 'bananas' in foods && 'grapes' in foods && 'strawberries' in foods, 'The foods object contains the following keys: apples, oranges, plums, bananas, grapes, and strawberries.');",
|
||||
"assert(checkInventory('apples') === 25 && checkInventory('bananas') === 13 && checkInventory('strawberries') === 27, 'The checkInventory function returns the value of the scannedItem argument in the foods object.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7c367417b2b2512b1b",
|
||||
"title": "Use the Delete Keyword to Remove Object Properties",
|
||||
"description": [
|
||||
"Now you know what objects are and their basic features and advantages. In short, they are key-value stores which provide a flexible, intuitive way to structure data and they provide very fast lookup time. For the rest of these challenges, we will describe several common operations you can perform on objects so you can become comfortable applying these useful data structures in your programs.",
|
||||
"Previously, we added and modified key-value pairs to objects. Here we will see how we can remove a key-value pair from an object. If we wanted to remove the apples key from our foods object from before, we could remove it by using the delete keyword like this:",
|
||||
"<code>delete foods.apples;</code>",
|
||||
"Instructions: Use the delete keyword to remove the oranges, plums, and strawberries keys from the foods object."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let foods = {",
|
||||
" apples: 25,",
|
||||
" oranges: 32,",
|
||||
" plums: 28,",
|
||||
" bananas: 13,",
|
||||
" grapes: 35,",
|
||||
" strawberries: 27",
|
||||
"};",
|
||||
"// change code below this line"
|
||||
],
|
||||
"tests": [
|
||||
"assert(!foods.hasOwnProperty('oranges') && !foods.hasOwnProperty('plums') && !foods.hasOwnProperty('bananas') && Object.keys(foods).length === 3, 'The foods object only has three keys: apples, grapes, and strawberries.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7d367417b2b2512b1c",
|
||||
"title": "Check if an Object has a Property",
|
||||
"description": [
|
||||
"Now we can add, modify, and remove keys from objects. But what if we just wanted to know if an object has a specific property? JavaScript provides two different ways to do this. One uses the hasOwnProperty method on the object and the other uses the in keyword. If we have an object users with a property of Alan, we could check for its presence in either of the following ways:",
|
||||
"<code>users.hasOwnProperty('Alan');</code>",
|
||||
"<code>'Alan' in users;</code>",
|
||||
"<code>// both return true</code>",
|
||||
"Instructions: We've created a users object here with some users in it and a function isEveryoneHere which we pass the users object to as an argument. Finish writing this function so that it returns true only if the users object contains all four names, Alan, Jeff, Sarah, and Ryan, as keys, and false otherwise."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let users = {",
|
||||
" Alan: {",
|
||||
" age: 27,",
|
||||
" online: true",
|
||||
" },",
|
||||
" Jeff: {",
|
||||
" age: 32,",
|
||||
" online: true",
|
||||
" },",
|
||||
" Sarah: {",
|
||||
" age: 48,",
|
||||
" online: true",
|
||||
" },",
|
||||
" Ryan: {",
|
||||
" age: 19,",
|
||||
" online: true",
|
||||
" }",
|
||||
"};",
|
||||
"function isEveryoneHere(obj) {",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
"};"
|
||||
],
|
||||
"tests": [
|
||||
"assert('Alan' in users && 'Jeff' in users && 'Sarah' in users && 'Ryan' in users && Object.keys(users).length === 4, 'The users object only contains the keys Alan, Jeff, Sarah, and Ryan.');",
|
||||
"assert(isEveryoneHere(users) === true, 'The function isEveryoneHere returns true if Alan, Jeff, Sarah, and Ryan are properties on the users object');",
|
||||
"assert((function() { delete users.Alan; delete users.Jeff; delete users.Sarah; delete users.Ryan; return isEveryoneHere(users) })() === false, 'The function isEveryoneHere returns false if Alan, Jeff, Sarah, and Ryan are not keys on the users object.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7d367417b2b2512b1d",
|
||||
"title": " Iterate Through the Keys of an Object with a for...in Statement",
|
||||
"description": [
|
||||
"Sometimes you may need to iterate through all the keys within an object. This requires a specific syntax in JavaScript called a for...in statement. For our users object from the last challenge, this could look like:",
|
||||
"<code>for (let user in users) {</code>",
|
||||
"<code> console.log(user);</code>",
|
||||
"<code>};</code>",
|
||||
"In this statement, we define a variable user. This variable will be set to the key in each iteration as the statement loops through the keys in the object. Running this code would print the name of each user to the console. Note that objects do not maintain an ordering to stored keys like arrays do.",
|
||||
"Instructions: We've defined a function countOnline that should return the number of users with the online property set to true. Use a for...in statement within this function to loop through the users in the users object and return the number of users whose online property is set to true."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let users = {",
|
||||
" Alan: {",
|
||||
" age: 27,",
|
||||
" online: false",
|
||||
" },",
|
||||
" Jeff: {",
|
||||
" age: 32,",
|
||||
" online: true",
|
||||
" },",
|
||||
" Sarah: {",
|
||||
" age: 48,",
|
||||
" online: false",
|
||||
" },",
|
||||
" Ryan: {",
|
||||
" age: 19,",
|
||||
" online: true",
|
||||
" }",
|
||||
"};",
|
||||
"function countOnline(obj) {",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
"};"
|
||||
],
|
||||
"tests": [
|
||||
"assert(users.Alan.online === false && users.Jeff.online === true && users.Sarah.online === false && users.Ryan.online === true, 'The users object contains users Jeff and Ryan with online set to true and users Alan and Sarah with online set to false.');",
|
||||
"assert((function() { users.Harry = {online: true}; users.Sam = {online: true}; users.Carl = {online: true}; return countOnline(users) })() === 5, 'The function countOnline returns the number of users with the online property set to true.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7d367417b2b2512b1e",
|
||||
"title": "Generate an Array of All Object Keys with Object.keys()",
|
||||
"description": [
|
||||
"We can also generate an array which contains all the keys stored in an object using the Object.keys() method and passing in an object as the argument. This will return an array with strings representing each property in the object. Again, there will be no specific order to the entries in the array.",
|
||||
"Instructions: Finish writing the getArrayOfUsers function so that it returns an array containing all the properties in the object it receives as an argument."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let users = {",
|
||||
" Alan: {",
|
||||
" age: 27,",
|
||||
" online: false",
|
||||
" },",
|
||||
" Jeff: {",
|
||||
" age: 32,",
|
||||
" online: true",
|
||||
" },",
|
||||
" Sarah: {",
|
||||
" age: 48,",
|
||||
" online: false",
|
||||
" },",
|
||||
" Ryan: {",
|
||||
" age: 19,",
|
||||
" online: true",
|
||||
" }",
|
||||
"};",
|
||||
"function getArrayOfUsers(obj) {",
|
||||
" // change code below this line",
|
||||
" // change code above this line",
|
||||
"};"
|
||||
],
|
||||
"tests": [
|
||||
"assert('Alan' in users && 'Jeff' in users && 'Sarah' in users && 'Ryan' in users && Object.keys(users).length === 4, 'The users object only contains the keys Alan, Jeff, Sarah, and Ryan.');",
|
||||
"assert((function() { users.Sam = {}; users.Lewis = {}; let R = getArrayOfUsers(users); return (R.indexOf('Alan') !== -1 && R.indexOf('Jeff') !== -1 && R.indexOf('Sarah') !== -1 && R.indexOf('Ryan') !== -1 && R.indexOf('Sam') !== -1 && R.indexOf('Lewis') !== -1); })() === true, 'The getArrayOfUsers function returns an array which contains all the keys in the users array.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7d367417b2b2512b1f",
|
||||
"title": "Modify an Array Stored in an Object",
|
||||
"description": [
|
||||
"Now you've seen all the basic operations for JavaScript objects. You can add, modify, and remove key-value pairs, check if keys exist, and iterate over all the keys in an object. As you continue learning JavaScript you will see even more versatile applications of objects. Additionally, the optional Advanced Data Structures lessons later in the curriculum also cover the ES6 Map and Set objects, both of which are similar to ordinary objects but provide some additional features. Now that you've learned the basics of arrays and objects, you're fully prepared to begin tackling more complex problems using JavaScript!",
|
||||
"Instructions: Take a look at the object we've provided in the code editor. The user object contains three keys. The data key contains four keys, one of which contains an array of friends. From this, you can see how flexible objects are as data structures. We've started writing a function addFriend. Finish writing it so that it takes a user object and adds the name of the friend argument to the array stored in user.data.friends."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let user = {",
|
||||
" name: 'Kenneth',",
|
||||
" age: 28,",
|
||||
" data: {",
|
||||
" username: 'kennethCodesAllDay',",
|
||||
" joinDate: 'March 26, 2016',",
|
||||
" organization: 'Free Code Camp',",
|
||||
" friends: [",
|
||||
" 'Sam',",
|
||||
" 'Kira',",
|
||||
" 'Tomo'",
|
||||
" ],",
|
||||
" location: {",
|
||||
" city: 'San Francisco',",
|
||||
" state: 'CA',",
|
||||
" country: 'USA'",
|
||||
" }",
|
||||
" }",
|
||||
"};",
|
||||
"function addFriend(user, friend) {",
|
||||
" // change code below this line ",
|
||||
" // change code above this line",
|
||||
"};"
|
||||
],
|
||||
"tests": [
|
||||
"assert('name' in user && 'age' in user && 'data' in user, 'The user object has name, age, and data keys');",
|
||||
"assert((function() { let L1 = user.data.friends.length; addFriend(user, 'Sean'); let L2 = user.data.friends.length; return (L2 === L1 + 1); })(), 'The addFriend function accepts a user object and a friend as arguments and adds the friend to the array of friends in the user object.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
},
|
||||
{
|
||||
"id": "587d7b7e367417b2b2512b20",
|
||||
"title": "Use an array to store a collection of data",
|
||||
"description": [
|
||||
"Arrays are JavaScript's most fundamental, and perhaps most common, data structure. An array is simply a collection of data, of any length (zero-indexed), arranged in a comma separated list and enclosed in brackets [ ]. While we often make the distinction in JavaScript between Objects and Arrays, it is important to note that technically, an array is a type of object.",
|
||||
"Arrays can store any type of data supported by JavaScript, and while they are a simple and basic form of data structure, they can also be very complex and powerful - all of which depends on how the programmer utilizes them.",
|
||||
"The below is an example of a valid array, notice it contains booleans, strings, numbers, other arrays (this is called a nested, or multi-dimensional array), and objects, among other valid data types:",
|
||||
"<code>let myArray = [undefined, null, true, false, 'one', 2, \"III\", {'four': 5}, [6, 'seven', 8]];</code>",
|
||||
"JavaScript offers many built in methods which allow us to access, traverse, and mutate arrays as needed, depending on our purpose. In the coming challenges, we will discuss several of the most common and useful methods, and a few other key techniques, that will help us to better understand and utilize arrays as data structures in JavaScript.",
|
||||
"Instructions",
|
||||
"We have defined a variable called yourArray; complete the declaration by defining an array of at least 5 elements in length. Your array should contain at least one string, one number, and one boolean."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let yourArray = // change code here;"
|
||||
],
|
||||
"tests": [
|
||||
"assert.strictEqual(Array.isArray(yourArray), true, 'yourArray is an array.');",
|
||||
"assert(yourArray.length >= 5, 'yourArray is at least 5 elements long.')",
|
||||
"assert(yourArray.filter( el => typeof el === 'boolean').length >= 1, '<code>yourArray</code> contains at least one boolean.');",
|
||||
"assert(yourArray.filter( el => typeof el === 'number').length >= 1, '<code>yourArray</code> contains at least one number.');",
|
||||
"assert(yourArray.filter( el => typeof el === 'string').length >= 1, '<code>yourArray</code> contains at least one string.');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"solutions": [],
|
||||
"challengeType": 0,
|
||||
"translations": {}
|
||||
}
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,240 @@
|
||||
{
|
||||
"name": "Claim Your JavaScript Algorithms and Data Structures Certificate",
|
||||
"order": 13,
|
||||
"time": "5 minutes",
|
||||
"challenges": [
|
||||
{
|
||||
"id": "587d7b7f367417b2b2512b25",
|
||||
"title": "Claim Your JavaScript Algorithms and Data Structures Certificate",
|
||||
"description": [
|
||||
[
|
||||
"//i.imgur.com/k8btNUB.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 algorithm scripting challenges, and all our basic, intermediate, and advanced front end development projects. You must also accept our Academic Honesty Pledge. Click the button below to start this process.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/uLPsUko.jpg",
|
||||
"The definition of plagiarism: Plagiarism (noun) - copying someone else’s work and presenting it as your own without crediting them",
|
||||
"By clicking below, you pledge that all of your submitted code A) is code you or your pair personally wrote, or B) comes from open source libraries like jQuery, or C) has been clearly attributed to its original authors. You also give us permission to audit your challenge solutions and revoke your certificate if we discover evidence of plagiarism.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/UedoV2G.jpg",
|
||||
"An image of the text \"Front End Development Certificate requirements\"",
|
||||
"Let's confirm that you have completed all of our basic and intermediate algorithm scripting challenges, and all our basic, intermediate, and advanced front end development projects. Click the button below to verify this.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/Q5Za9U6.jpg",
|
||||
"An image of the word \"Congratulations\"",
|
||||
"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.",
|
||||
""
|
||||
]
|
||||
],
|
||||
"challengeSeed": [
|
||||
{
|
||||
"properties": [
|
||||
"isHonest",
|
||||
"isFrontEndCert"
|
||||
],
|
||||
"apis": [
|
||||
"/certificate/honest",
|
||||
"/certificate/verify/front-end"
|
||||
],
|
||||
"stepIndex": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"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": "579e2a2c335b9d72dd32e05c",
|
||||
"title": "Splice and Slice"
|
||||
},
|
||||
{
|
||||
"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": "Wherefore 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": "56533eb9ac21ba0edf2244e2",
|
||||
"title": "Caesars Cipher"
|
||||
},
|
||||
{
|
||||
"id": "a2f1d72d9b908d0bd72bb9f6",
|
||||
"title": "Make a Person"
|
||||
},
|
||||
{
|
||||
"id": "af4afb223120f7348cdfc9fd",
|
||||
"title": "Map the Debris"
|
||||
}
|
||||
],
|
||||
"type": "Waypoint",
|
||||
"challengeType": 7,
|
||||
"descriptionEs": [
|
||||
[
|
||||
"//i.imgur.com/k8btNUB.jpg",
|
||||
"Una imagen que muestra nuestro certificado de Desarrollo de interfaces",
|
||||
"Este desafío te otorga tu certificado autenticado de Desarrollo de interfaces. Antes de que podamos emitir tu certificado, debemos verificar que has completado todos los desafíos básicos e intermedios de diseño de algoritmos, y todos los proyectos básicos e intermedios de desarrollo de interfaces. También debes aceptar nuestro Juramento de honestidad académica. Pulsa el botón siguiente para iniciar este proceso.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/HArFfMN.jpg",
|
||||
"Plagio (nombre): acción y efecto de plagiar. Plagiar (verbo) - copiar en lo sustancial obras ajenas, dándolas como propias.",
|
||||
"Al pulsar el botón siguiente, juras que todo el código en tus soluciones a los desafíos A) es código que tú o tu compañero escribieron personalmente, o B) proviene de librerías de código abierto como jQuery, o C) ha sido claramente atribuido a sus autores originales. También nos otorgas el permiso para auditar tus soluciones a los desafíos y revocar tu certificado si encontramos evidencia de plagio.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/14F2Van.jpg",
|
||||
"Una imagen del texto \"Front End Development Certificate requirements\"",
|
||||
"Confirmemos que has completado todos nuestros desafíos básicos e intermedios de diseño de algoritmos, y todos nuestros proyectos básicos e intermedios de desarrollo de interfaces. Pulsa el botón siguiente para hacer la verificación.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/16SIhHO.jpg",
|
||||
"Una imagen de la palabra \"Congratulations\"",
|
||||
"¡Felicitaciones! Hemos agregado tu certificado de Desarrollo de interfaces a tu portafolio. A menos que elijas no mostrar tus soluciones, este certificado será públicamente visible y verificable.",
|
||||
""
|
||||
]
|
||||
],
|
||||
"titleEs": "Reclama tu certificado de Desarrollo de interfaces"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,589 @@
|
||||
{
|
||||
"name": "Debugging",
|
||||
"order": 4,
|
||||
"time": "1 hour",
|
||||
"helpRoom": "Help",
|
||||
"challenges": [
|
||||
{
|
||||
"id": "587d7b83367417b2b2512b32",
|
||||
"title": "Introduction to the Debugging Challenges",
|
||||
"description": [
|
||||
[
|
||||
"http://imgs.xkcd.com/comics/debugging.png",
|
||||
"XKCD web comic walking through the convoluted process of debugging. The programmer moves from a browser problem, to a keyboard driver issue, receives a cryptic system utility error message, and ends by finding the sword of Martin the Warrior.",
|
||||
"Debugging is a valuable and (unfortunately) necessary tool for programmers. It follows the testing phase of checking if your code works as intended, and discovering it does not. Debugging is the process of finding exactly what isn't working and fixing it.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"",
|
||||
"",
|
||||
"After spending time creating a brilliant block of code, it is tough realizing it may have errors. These issues generally come in three forms: 1) syntax errors that prevent a program from running, 2) runtime errors when code fails to execute or has unexpected behavior, and 3) semantic (or logical) errors when code doesn't do what it's meant to.<br><br>Modern code editors (and experience) can help identify syntax errors. Semantic and runtime errors are harder to find. They may cause your program to crash, make it run forever, or give incorrect output. Think of debugging as trying to understand why your code is behaving the way it is.<br><br>Example of a syntax error - often detected by the code editor:<br><br><blockquote>funtion willNotWork( {<br> console.log(\"Yuck\");<br>}<br>// \"function\" keyword is misspelled and there's a missing parenthesis</blockquote><br><br>Here's an example of a runtime error - often detected while the program executes:<br><br><blockquote>function loopy() {<br> while(true) {<br> console.log(\"Hello, world!\");<br> }<br>}<br>// Calling loopy starts an infinite loop, which may crash your browser</blockquote><br><br>Example of a semantic error - often detected after testing code output:<br><br><blockquote>function calcAreaOfRect(w, h) {<br> return w + h; // This should be w * h<br>}<br>let myRectArea = calcAreaOfRect(2, 3);<br>// Correct syntax and the program executes, but this gives the wrong answer</blockquote>",
|
||||
""
|
||||
],
|
||||
[
|
||||
"",
|
||||
"",
|
||||
"Debugging is frustrating, but it helps to develop (and follow) a step-by-step approach to review your code. This means checking the intermediate values and types of variables to see if they are what they should be. You can start with a simple process of elimination.<br><br>For example, if function A works and returns what it's supposed to, then function B may have the issue. Or start checking values in a block of code from the middle to try to cut the search space in half. A problem in one spot indicates a bug in the first half of the code. If not, it's likely in the second.<br><br>This section will cover a couple helpful tools to find bugs, and some of the common forms they take. Fortunately, debugging is a learnable skill that just requires a little patience and practice to master.",
|
||||
""
|
||||
]
|
||||
],
|
||||
"releasedOn": "",
|
||||
"challengeSeed": [],
|
||||
"tests": [],
|
||||
"type": "Waypoint",
|
||||
"challengeType": 7,
|
||||
"isRequired": false,
|
||||
"titleEs": "",
|
||||
"descriptionEs": [
|
||||
[]
|
||||
],
|
||||
"titleFr": "",
|
||||
"descriptionFr": [
|
||||
[]
|
||||
],
|
||||
"titleDe": "",
|
||||
"descriptionDe": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "587d7b83367417b2b2512b33",
|
||||
"title": "Use the JavaScript Console to Check the Value of a Variable",
|
||||
"description": [
|
||||
"Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript.",
|
||||
"You can find Developer tools in your Chrome's menu or Web Console in FireFox's menu. If you're using a different browser, or a mobile phone, we strongly recommend switching to desktop Firefox or Chrome.",
|
||||
"The <code>console.log()</code> method, which \"prints\" the output of what's within its parentheses to the console, will likely be the most helpful debugging tool. Placing it at strategic points in your code can show you the intermediate values of variables. It's good practice to have an idea of what the output should be before looking at what it is. Having check points to see the status of your calculations throughout your code will help narrow down where the problem is.",
|
||||
"Here's an example to print 'Hello world!' to the console:",
|
||||
"<code>console.log('Hello world!');</code>",
|
||||
"<h4>Instructions</h4>",
|
||||
"Use the <code>console.log()</code> method to print the value of the variable <code>a</code> where noted in the code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let a = 5;",
|
||||
"let b = 1;",
|
||||
"a++;",
|
||||
"// Add your code below this line",
|
||||
"",
|
||||
"",
|
||||
"let sumAB = a + b;",
|
||||
"console.log(sumAB);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(code.match(/console\\.log\\(a\\)/g), 'message: Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.');"
|
||||
],
|
||||
"solutions": [
|
||||
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b84367417b2b2512b34",
|
||||
"title": "Use typeof to Check the Type of a Variable",
|
||||
"description": [
|
||||
"You can use <code>typeof</code> to check the data structure, or type, of a variable. This is useful in debugging when working with multiple data types. If you think you're adding two numbers, but one is actually a string, the results can be unexpected. Type errors can lurk in calculations or function calls. Especially take care when you're accessing and working with external data in the form of a JavaScript object (JSON).",
|
||||
"Here are some examples using <code>typeof</code>:",
|
||||
"<blockquote>console.log(typeof \"\"); // outputs \"string\"<br>console.log(typeof 0); // outputs \"number\"<br>console.log(typeof []); // outputs \"object\"<br>console.log(typeof {}); // outputs \"object\"</blockquote>",
|
||||
"JavaScript recognizes six primitive (immutable) data types: <code>Boolean</code>, <code>Null</code>, <code>Undefined</code>, <code>Number</code>, <code>String</code>, and <code>Symbol</code> (new with ES6) and one type for mutable items: <code>Object</code>. Note that in JavaScript, arrays are technically a type of object.",
|
||||
"<h4>Instructions</h4>",
|
||||
"Add two <code>console.log()</code> statements to check the <code>typeof</code> each of the two variables <code>seven</code> and <code>three</code> in the code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let seven = 7;",
|
||||
"let three = \"3\";",
|
||||
"console.log(seven + three);",
|
||||
"// Add your code below this line",
|
||||
""
|
||||
],
|
||||
"tests": [
|
||||
"assert(code.match(/console\\.log\\(typeof[\\( ].*\\)?\\);/g).length == 2, 'message: Your code should use <code>typeof</code> in two <code>console.log()</code> statements to check the type of the variables.');",
|
||||
"assert(code.match(/typeof[\\( ]seven\\)?/g), 'message: Your code should use <code>typeof</code> to check the type of the variable <code>seven</code>.');",
|
||||
"assert(code.match(/typeof[\\( ]three\\)?/g), 'message: Your code should use <code>typeof</code> to check the type of the variable <code>three</code>.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b84367417b2b2512b35",
|
||||
"title": "Catch Misspelled Variable and Function Names",
|
||||
"description": [
|
||||
"The <code>console.log()</code> and <code>typeof</code> methods are the two primary ways to check intermediate values and types of program output. Now it's time to get into the common forms that bugs take. One syntax-level issue that fast typers can commiserate with is the humble spelling error.",
|
||||
"Transposed, missing, or mis-capitalized characters in a variable or function name will have the browser looking for an object that doesn't exist - and complain in the form of a reference error. JavaScript variable and function names are case-sensitive.",
|
||||
"<h4>Instructions</h4>",
|
||||
"Fix the two spelling errors in the code so the <code>netWorkingCapital</code> calculation works."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let receivables = 10;",
|
||||
"let payables = 8;",
|
||||
"let netWorkingCapital = recievables - payable;",
|
||||
"console.log(`Net working capital is: ${netWorkingCapital}`);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(netWorkingCapital === 2, 'message: Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that \"Net working capital is: 2\".');",
|
||||
"assert(!code.match(/recievables/g), 'message: There should be no instances of mis-spelled variables in the code.');",
|
||||
"assert(code.match(/receivables/g).length == 2, 'message: The <code>receivables</code> variable should be declared and used properly in the code.');",
|
||||
"assert(!code.match(/payable;/g), 'message: There should be no instances of mis-spelled variables in the code.');",
|
||||
"assert(code.match(/payables/g).length == 2, 'message: The <code>payables</code> variable should be declared and used properly in the code.');"
|
||||
],
|
||||
"solutions": [
|
||||
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b84367417b2b2512b36",
|
||||
"title": "Catch Unclosed Parentheses, Brackets, Braces and Quotes",
|
||||
"description": [
|
||||
"Another syntax error to be aware of is that all opening parentheses, brackets, curly braces, and quotes have a closing pair. Forgetting a piece tends to happen when you're editing existing code and inserting items with one of the pair types. Also, take care when nesting code blocks into others, such as adding a callback function as an argument to a method.",
|
||||
"One way to avoid this mistake is as soon as the opening character is typed, immediately include the closing match, then move the cursor back between them and continue coding. Fortunately, most modern code editors generate the second half of the pair automatically.",
|
||||
"<h4>Instructions</h4>",
|
||||
"Fix the two pair errors in the code."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let myArray = [1, 2, 3;",
|
||||
"let arraySum = myArray.reduce((previous, current => previous + current);",
|
||||
"console.log(`Sum of array values is: ${arraySum}`);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(code.match(/myArray\\s*?=\\s*?\\[\\s*?1\\s*?,\\s*?2\\s*?,\\s*?3\\s*?\\];/g), 'message: Your code should fix the missing piece of the array.');",
|
||||
"assert(arraySum === 6, 'message: Your code should fix the missing piece of the <code>.reduce()</code> method. The console output should show that \"Sum of array values is: 6\".');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b84367417b2b2512b37",
|
||||
"title": "Catch Mixed Usage of Single and Double Quotes",
|
||||
"description": [
|
||||
"JavaScript allows the use of both single ('') and double (\"\") quotes to declare a string. Deciding which one to use generally comes down to personal preference, with some exceptions.",
|
||||
"Having two choices is great when a string has contractions or another piece of text that's in quotes. Just be careful that you don't close the string too early, which causes a syntax error.",
|
||||
"Here are some examples of mixing quotes:",
|
||||
"<blockquote>// These are correct:<br>const grouchoContraction = \"I've had a perfectly wonderful evening, but this wasn't it.\";<br>const quoteInString = \"Groucho Marx once said 'Quote me as saying I was mis-quoted.'\";<br>// This is incorrect:<br>const uhOhGroucho = 'I've had a perfectly wonderful evening, but this wasn't it.';</blockquote>",
|
||||
"Of course, it is okay to use only one style of quotes. You can escape the quotes inside the string by using the backslash (\\) escape character:",
|
||||
"<blockquote>// Correct use of same quotes:<br>const allSameQuotes = 'I\\'ve had a perfectly wonderful evening, but this wasn\\'t it.';</blockquote>",
|
||||
"<h4>Instructions</h4>",
|
||||
"Fix the string so it either uses different quotes for the <code>href</code> value, or escape the existing ones. Keep the double quote marks around the entire string."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let innerHtml = \"<p>Click here to <a href=\"#Home\">return home</a></p>\";",
|
||||
"console.log(innerHtml);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(code.match(/<a href=\\s*?('|\\\\\")#Home\\1\\s*?>/g), 'message: Your code should fix the quotes around the <code>href</code> value \"#Home\" by either changing or escaping them.');",
|
||||
"assert(code.match(/\"<p>.*?<\\/p>\";/g), 'message: Your code should keep the double quotes around the entire string.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b85367417b2b2512b38",
|
||||
"title": "Catch Use of Assignment Operator Instead of Equality Operator",
|
||||
"description": [
|
||||
"Branching programs, i.e. ones that do different things if certain conditions are met, rely on <code>if</code>, <code>else if</code>, and <code>else</code> statements in JavaScript. The condition sometimes takes the form of testing whether a result is equal to a value.",
|
||||
"This logic is spoken (in English, at least) as \"if x equals y, then ...\" which can literally translate into code using the <code>=</code>, or assignment operator. This leads to unexpected control flow in your program.",
|
||||
"As covered in previous challenges, the assignment operator (<code>=</code>) in JavaScript assigns a value to a variable name. And the <code>==</code> and <code>===</code> operators check for equality (the triple <code>===</code> tests for strict equality, meaning both value and type are the same).",
|
||||
"The code below assigns <code>x</code> to be 2, which evaluates as <code>true</code>. Almost every value on its own in JavaScript evaluates to <code>true</code>, except what are known as the \"falsy\" values: <code>false</code>, <code>0</code>, <code>\"\"</code> (an empty string), <code>NaN</code>, <code>undefined</code>, and <code>null</code>.",
|
||||
"<blockquote>let x = 1;<br>let y = 2;<br>if (x = y) {<br> // this code block will run for any value of y (unless y were originally set as a falsy)<br>} else {<br> // this code block is what should run (but won't) in this example<br>}</blockquote>",
|
||||
"<h4>Instructions</h4>",
|
||||
"Fix the condition so the program runs the right branch, and the appropriate value is assigned to <code>result</code>."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"let x = 7;",
|
||||
"let y = 9;",
|
||||
"let result = \"to come\";",
|
||||
"",
|
||||
"if(x = y) {",
|
||||
" result = \"Equal!\";",
|
||||
"} else {",
|
||||
" result = \"Not equal!\";",
|
||||
"}",
|
||||
"",
|
||||
"console.log(result);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(result == \"Not equal!\", 'message: Your code should fix the condition so it checks for equality, instead of using assignment.');",
|
||||
"assert(code.match(/x\\s*?===?\\s*?y/g), 'message: The condition can use either <code>==</code> or <code>===</code> to test for equality.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b85367417b2b2512b39",
|
||||
"title": "Catch Missing Open and Closing Parenthesis After a Function Call",
|
||||
"description": [
|
||||
"When a function or method doesn't take any arguments, you may forget to include the (empty) opening and closing parentheses when calling it. Often times the result of a function call is saved in a variable for other use in your code. This error can be detected by logging variable values (or their types) to the console and seeing that one is set to a function reference, instead of the expected value the function returns.",
|
||||
"The variables in the following example are different:",
|
||||
"<blockquote>function myFunction() {<br> return \"You rock!\";<br>}<br>let varOne = myFunction; // set to equal a function<br>let varTwo = myFunction(); // set to equal the string \"You rock!\"</blockquote>",
|
||||
"<h4>Instructions</h4>",
|
||||
"Fix the code so the variable <code>result</code> is set to the value returned from calling the function <code>getNine</code>."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function getNine() {",
|
||||
" let x = 6;",
|
||||
" let y = 3;",
|
||||
" return x + y;",
|
||||
"}",
|
||||
"",
|
||||
"let result = getNine;",
|
||||
"console.log(result);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(result == 9, 'message: Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.');",
|
||||
"assert(code.match(/getNine\\(\\)/g).length == 2, 'message: Your code should call the <code>getNine</code> function.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b85367417b2b2512b3a",
|
||||
"title": "Catch Arguments Passed in the Wrong Order When Calling a Function",
|
||||
"description": [
|
||||
"Continuing the discussion on calling functions, the next bug to watch out for is when a function's arguments are supplied in the incorrect order. If the arguments are different types, such as a function expecting an array and an integer, this will likely throw a runtime error. If the arguments are the same type (all integers, for example), then the logic of the code won't make sense. Make sure to supply all required arguments, in the proper order to avoid these issues.",
|
||||
"<h4>Instructions</h4>",
|
||||
"The following function <code>positivePowers</code> raises a base to a positive exponent. Unfortunately, it's not called properly - fix the code so the value of <code>power</code> is the expected 8."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function positivePowers(b, e) {",
|
||||
" let result = 1;",
|
||||
" if (e <= 0) return result;",
|
||||
" for (let i = 1; i <= e; i++) {",
|
||||
" result *= b;",
|
||||
" }",
|
||||
" return result;",
|
||||
"}",
|
||||
"",
|
||||
"let base = 2;",
|
||||
"let exp = 3;",
|
||||
"let power = positivePowers(exp, base);",
|
||||
"console.log(power);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(power == 8, 'message: Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.');",
|
||||
"assert(code.match(/positivePowers\\(\\s*?base\\s*?,\\s*?exp\\s*?\\);/g), 'message: Your code should use the correct order of the arguments for the <code>positivePowers</code> function call.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b86367417b2b2512b3b",
|
||||
"title": "Catch Off By One Errors When Using Indexing",
|
||||
"description": [
|
||||
"<code>Off by one errors</code> (sometimes called OBOE) crop up when you're trying to target a specific index of a string or array (to slice or access a segment), or when looping over the indices of them. JavaScript indexing starts at zero, not one, which means the last index is always one less than the length of the item. If you try to access an index equal to the length, the program may throw an \"index out of range\" reference error or print <code>undefined</code>.",
|
||||
"When you use string or array methods that take index ranges as arguments, it helps to read the documentation and understand if they are inclusive (the item at the given index is part of what's returned) or not. Here are some examples of off by one errors:",
|
||||
"<blockquote>let alphabet = \"abcdefghijklmnopqrstuvwxyz\";<br>let len = alphabet.length;<br>for (let i = 0; i <= len; i++) {<br> // loops one too many times at the end<br> console.log(alphabet[i]);<br>}<br>for (let j = 1; j < len; j++) {<br> // loops one too few times and misses the first character at index 0<br> console.log(alphabet[j]);<br>}<br>for (let k = 0; k < len; k++) {<br> // Goldilocks approves - this is just right<br> console.log(alphabet[k]);<br>}</blockquote>",
|
||||
"<h4>Instructions</h4>",
|
||||
"Fix the two indexing errors in the following function so all the numbers 1 through 5 are printed to the console."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function countToFive() {",
|
||||
" let firstFive = \"12345\";",
|
||||
" let len = firstFive.length;",
|
||||
" for (let i = 1; i <= len; i++) {",
|
||||
" console.log(firstFive[i]);",
|
||||
" }",
|
||||
"}",
|
||||
"",
|
||||
"countToFive();"
|
||||
],
|
||||
"tests": [
|
||||
"assert(code.match(/i\\s*?=\\s*?0\\s*?;/g).length == 1, 'message: Your code should set the initial condition of the loop so it starts at the first index.');",
|
||||
"assert(!code.match(/i\\s?=\\s*?1\\s*?;/g), 'message: Your code should fix the initial condition of the loop.');",
|
||||
"assert(code.match(/i\\s*?<\\s*?len\\s*?;/g).length == 1, 'message: Your code should set the terminal condition of the loop so it stops at the last index.');",
|
||||
"assert(!code.match(/i\\s*?<=\\s*?len;/g), 'message: Your code should fix the terminal condition of the loop.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b86367417b2b2512b3c",
|
||||
"title": "Use Caution When Reinitializing Variables Inside a Loop",
|
||||
"description": [
|
||||
"Sometimes it's necessary to save information, increment counters, or re-set variables within a loop. A potential issue is when variables either should be reinitialized, and aren't, or vice versa. This is particularly dangerous if you accidentally reset the variable being used for the terminal condition, causing an infinite loop.",
|
||||
"Printing variable values with each cycle of your loop by using <code>console.log()</code> can uncover buggy behavior related to resetting, or failing to reset a variable.",
|
||||
"<h4>Instructions</h4>",
|
||||
"The following function is supposed to create a two-dimensional array with <code>m</code> rows and <code>n</code> columns of zeroes. Unfortunately, it's not producing the expected output because the <code>row</code> variable isn't being reinitialized (set back to an empty array) in the outer loop. Fix the code so it returns a correct 3x2 array of zeroes, which looks like <code>[[0, 0], [0, 0], [0, 0]]</code>."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function zeroArray(m, n) {",
|
||||
" // Creates a 2-D array with m rows and n columns of zeroes",
|
||||
" let newArray = [];",
|
||||
" let row = [];",
|
||||
" for (let i = 0; i < m; i++) {",
|
||||
" // Adds the m-th row into newArray",
|
||||
" ",
|
||||
" for (let j = 0; j < n; j++) {",
|
||||
" // Pushes n zeroes into the current row to create the columns",
|
||||
" row.push(0);",
|
||||
" }",
|
||||
" // Pushes the current row, which now has n zeroes in it, to the array",
|
||||
" newArray.push(row);",
|
||||
" }",
|
||||
" return newArray;",
|
||||
"}",
|
||||
"",
|
||||
"let matrix = zeroArray(3, 2);",
|
||||
"console.log(matrix);"
|
||||
],
|
||||
"tests": [
|
||||
"assert(JSON.stringify(matrix) == \"[[0,0],[0,0],[0,0]]\", 'message: Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.');",
|
||||
"assert(matrix.length == 3, 'message: The <code>matrix</code> variable should have 3 rows.');",
|
||||
"assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2, 'message: The <code>matrix</code> variable should have 2 columns in each row.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "587d7b86367417b2b2512b3d",
|
||||
"title": "Prevent Infinite Loops with a Valid Terminal Condition",
|
||||
"description": [
|
||||
"The final topic is the dreaded infinite loop. Loops are great tools when you need your program to run a code block a certain number of times or until a condition is met, but they need a terminal condition that ends the looping. Infinite loops are likely to freeze or crash the browser, and cause general program execution mayhem, which no one wants.",
|
||||
"There was an example of an infinite loop in the introduction to this section - it had no terminal condition to break out of the <code>while</code> loop inside <code>loopy()</code>. Do NOT call this function!",
|
||||
"<blockquote>function loopy() {<br> while(true) {<br> console.log(\"Hello, world!\");<br> }<br>}</blockquote>",
|
||||
"It's the programmer's job to ensure that the terminal condition, which tells the program when to break out of the loop code, is eventually reached. One error is incrementing or decrementing a counter variable in the wrong direction from the terminal condition. Another one is accidentally resetting a counter or index variable within the loop code, instead of incrementing or decrementing it.",
|
||||
"<h4>Instructions</h4>",
|
||||
"The <code>myFunc()</code> function contains an infinite loop because the terminal condition <code>i != 4</code> will never evaluate to <code>false</code> (and break the looping) - <code>i</code> will increment by 2 each pass, and jump right over 4 since <code>i</code> is odd to start. Fix the comparison operator in the terminal condition so the loop only runs for <code>i</code> less than or equal to 4."
|
||||
],
|
||||
"challengeSeed": [
|
||||
"function myFunc() {",
|
||||
" for (let i = 1; i != 4; i += 2) {",
|
||||
" console.log(\"Still going!\");",
|
||||
" }",
|
||||
"}"
|
||||
],
|
||||
"tests": [
|
||||
"assert(code.match(/i\\s*?<=\\s*?4;/g).length == 1, 'message: Your code should change the comparison operator in the terminal condition (the middle part) of the <code>for</code> loop.');",
|
||||
"assert(!code.match(/i\\s*?!=\\s*?4;/g), 'message: Your code should fix the comparison operator in the terminal condition of the loop.');"
|
||||
],
|
||||
"solutions": [
|
||||
],
|
||||
"hints": [],
|
||||
"type": "waypoint",
|
||||
"challengeType": 1,
|
||||
"translations": {
|
||||
"de": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"fr": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"pt-br": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
},
|
||||
"ru": {
|
||||
"description": [],
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
1054
challenges/02-javascript-algorithms-and-data-structures/es6.json
Normal file
1054
challenges/02-javascript-algorithms-and-data-structures/es6.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,232 @@
|
||||
{
|
||||
"name": "Claim Your JavaScript Algorithms and Data Structures Certificate",
|
||||
"order": 13,
|
||||
"time": "5 minutes",
|
||||
"challenges": [
|
||||
{
|
||||
"id": "587d7dac367417b2b2512b71",
|
||||
"title": "Claim Your JavaScript Algorithms and Data Structures Certificate",
|
||||
"description": [
|
||||
[
|
||||
"//i.imgur.com/k8btNUB.jpg",
|
||||
"An image of our JavaScript Algorithms and Data Structures Certificate",
|
||||
"This challenge will give you your verified JavaScript Algorithms and Data Structures Certificate. Before we issue your certificate, we must verify that you have completed all of our basic and intermediate algorithm scripting challenges, and all our basic, intermediate, and advanced front end development projects. You must also accept our Academic Honesty Pledge. Click the button below to start this process.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/uLPsUko.jpg",
|
||||
"The definition of plagiarism: Plagiarism (noun) - copying someone else’s work and presenting it as your own without crediting them",
|
||||
"By clicking below, you pledge that all of your submitted code A) is code you or your pair personally wrote, or B) comes from open source libraries like jQuery, or C) has been clearly attributed to its original authors. You also give us permission to audit your challenge solutions and revoke your certificate if we discover evidence of plagiarism.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/UedoV2G.jpg",
|
||||
"An image of the text \"Front End Development Certificate requirements\"",
|
||||
"Let's confirm that you have completed all of our basic and intermediate algorithm scripting challenges, and all our basic, intermediate, and advanced front end development projects. Click the button below to verify this.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/Q5Za9U6.jpg",
|
||||
"An image of the word \"Congratulations\"",
|
||||
"Congratulations! We've added your JavaScript Algorithms and Data Structures Certificate to your portfolio page. Unless you choose to hide your solutions, this certificate will remain publicly visible and verifiable.",
|
||||
""
|
||||
]
|
||||
],
|
||||
"challengeSeed": [
|
||||
{
|
||||
"properties": [
|
||||
"isHonest",
|
||||
"isFrontEndCert"
|
||||
],
|
||||
"apis": [
|
||||
"/certificate/honest",
|
||||
"/certificate/verify/front-end"
|
||||
],
|
||||
"stepIndex": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"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": "Wherefore 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"
|
||||
}
|
||||
],
|
||||
"type": "Waypoint",
|
||||
"challengeType": 7,
|
||||
"translations": {
|
||||
"es": {
|
||||
"title": "Reclama tu certificado de Desarrollo de interfaces",
|
||||
"description": [
|
||||
[
|
||||
"//i.imgur.com/k8btNUB.jpg",
|
||||
"Una imagen que muestra nuestro certificado de Desarrollo de interfaces",
|
||||
"Este desafío te otorga tu certificado autenticado de Desarrollo de interfaces. Antes de que podamos emitir tu certificado, debemos verificar que has completado todos los desafíos básicos e intermedios de diseño de algoritmos, y todos los proyectos básicos e intermedios de desarrollo de interfaces. También debes aceptar nuestro Juramento de honestidad académica. Pulsa el botón siguiente para iniciar este proceso.",
|
||||
""
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/HArFfMN.jpg",
|
||||
"Plagio (nombre): acción y efecto de plagiar. Plagiar (verbo) - copiar en lo sustancial obras ajenas, dándolas como propias.",
|
||||
"Al pulsar el botón siguiente, juras que todo el código en tus soluciones a los desafíos A) es código que tú o tu compañero escribieron personalmente, o B) proviene de librerías de código abierto como jQuery, o C) ha sido claramente atribuido a sus autores originales. También nos otorgas el permiso para auditar tus soluciones a los desafíos y revocar tu certificado si encontramos evidencia de plagio.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/14F2Van.jpg",
|
||||
"Una imagen del texto \"Front End Development Certificate requirements\"",
|
||||
"Confirmemos que has completado todos nuestros desafíos básicos e intermedios de diseño de algoritmos, y todos nuestros proyectos básicos e intermedios de desarrollo de interfaces. Pulsa el botón siguiente para hacer la verificación.",
|
||||
"#"
|
||||
],
|
||||
[
|
||||
"//i.imgur.com/16SIhHO.jpg",
|
||||
"Una imagen de la palabra \"Congratulations\"",
|
||||
"¡Felicitaciones! Hemos agregado tu certificado de Desarrollo de interfaces a tu portafolio. A menos que elijas no mostrar tus soluciones, este certificado será públicamente visible y verificable.",
|
||||
""
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user