{
  "name": "Basic Algorithm Scripting",
  "order": 6,
  "time": "50 hours",
  "helpRoom": "HelpJavaScript",
  "challenges": [
    {
      "id": "bd7158d2c442eddfbeb5bd1f",
      "title": "Get Set for our Algorithm Lessons",
      "description": [
        [
          "",
          "",
          "freeCodeCamp's algorithm challenges will teach you how to think like a programmer.",
          ""
        ],
        [
          "",
          "",
          "The previous lessons introduced you to programming concepts. But for these algorithm lessons, you'll now need to apply what you learned to solve open-ended problems.",
          ""
        ],
        [
          "",
          "",
          "These algorithm lessons are hard. Some of them may take you several hours to solve. You may get frustrated. But don't quit.",
          ""
        ],
        [
          "",
          "",
          "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": [
            [
              "https://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.",
              ""
            ],
            [
              "https://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",
              ""
            ],
            [
              "https://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.",
              ""
            ],
            [
              "https://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 nossos desafios de algoritmos",
          "description": [
            [
              "https://i.imgur.com/sJkp30a.png",
              "Uma imagem de um desafio de algoritmo mostrando instruções, testes e o editor de código.",
              "Nossos desafios de algoritmos vão te ensinar a pensar como um programador.",
              ""
            ],
            [
              "https://i.imgur.com/d8LuRNh.png",
              "Uma mãe pássaro expulsa seu filhote do ninho.",
              "Os desafios anteriores te apresentaram os conceitos de programação. Mas para esses desafios de algoritmos, você terá que aplicar o que aprendeu para resolver problemas abertos.",
              ""
            ],
            [
              "https://i.imgur.com/WBetuBa.jpg",
              "Um programador frustrado atravessando a tela de seu laptop com um soco.",
              "Os desafios de algoritmos são difíceis. Você pode levar várias horas para resolver alguns deles. Você vai ficar frustado. Mas não desista.",
              ""
            ],
            [
              "https://i.imgur.com/p2TpOQd.jpg",
              "Um cachorro fofo pulando sobre um obstáculo, piscando e apontando a pata na sua direção.",
              "Quando ficar travado, use a metodologia Ler-Pesquisar-Perguntar.<br>Não se preocupe - você consegue.",
              ""
            ]
          ]
        }
      }
    },
    {
      "id": "56533eb9ac21ba0edf2244b3",
      "title": "Convert Celsius to Fahrenheit",
      "description": [
        "The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times <code>9/5</code>, plus <code>32</code>.",
        "You are given a variable <code>celsius</code> representing a temperature in Celsius. Use the variable <code>fahrenheit</code> already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature. Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit.",
        "Don't worry too much about the function and return statements as they will be covered in future challenges. For now, only use operators that you have already learned."
      ],
      "releasedOn": "January 1, 2016",
      "challengeSeed": [
        "function convertToF(celsius) {",
        "  let fahrenheit;",
        "  return fahrenheit;",
        "}",
        "",
        "convertToF(30);"
      ],
      "solutions": [
        "function convertToF(celsius) {\n  let fahrenheit = celsius * 9/5 + 32;\n\n  return fahrenheit;\n}\n\nconvertToF(30);\n"
      ],
      "tests": [
        "assert(typeof convertToF(0) === 'number', 'message: <code>convertToF(0)</code> should return a number');",
        "assert(convertToF(-30) === -22, 'message: <code>convertToF(-30)</code> should return a value of <code>-22</code>');",
        "assert(convertToF(-10) === 14, 'message: <code>convertToF(-10)</code> should return a value of <code>14</code>');",
        "assert(convertToF(0) === 32, 'message: <code>convertToF(0)</code> should return a value of <code>32</code>');",
        "assert(convertToF(20) === 68, 'message: <code>convertToF(20)</code> should return a value of <code>68</code>');",
        "assert(convertToF(30) === 86, 'message: <code>convertToF(30)</code> should return a value of <code>86</code>');"
      ],
      "type": "checkpoint",
      "challengeType": 1,
      "isRequired": true,
      "translations": {
        "es": {
          "title": "Convierte celsius a fahrenheit",
          "description": [
            "Para probar tu aprendizaje, crearás una solucion \"desde cero\". Coloca tu código entre las líneas indicadas y este será probado contra multiples casos de prueba.",
            "El algoritmo para convertir de Celsius a Fahrenheit consiste en multiplicar la temperatura en grados Celsius por 9/5 y al resultado agregarle 32.",
            "Se te da una variable <code>celsius</code> representando una temperatura en Celsius. Crea una variable <code>fahrenheit</code> y aplica el algoritmo para asignar la correspondiente temperatura en Fahrenheit."
          ]
        },
        "pt-br": {
          "title": "Converta Celsius para Fahrenheit",
          "description": [
            "O algoritmo para converter de Celsius para Fahrenheit é a temperatura em Celsius vezes <code>9/5</code> mais <code>32</code>.",
            "Você recebe uma variável <code>celsius</code> representando uma temperatura em Celsius. Use a variável <code>fahrenheit</code> já definida e aplique o algoritmo para atribuir a ela a temperatura correspondente em Fahrenheit."
          ]
        }
      }
    },
    {
      "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.org/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.org/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": "Inverta uma string",
          "description": [
            "Inverta a string fornecida.",
            "Talvez você tenha que transformar a string num array antes de invertê-la.",
            "Seu resultado deve ser uma string.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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.org/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": "Determine o fatorial de um número",
          "description": [
            "Retorne o fatorial do inteiro fornecido.",
            "Se o inteiro é representado pela letra n, o seu fatorial é o produto de todos os inteiros positivos menores ou iguais a n.",
            "Por exemplo: <code>5! = 1 * 2 * 3 * 4 * 5 = 120</code>",
            "Apenas inteiros maiores ou iguais a zero serão fornecidos à função.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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 findLongestWordLength(str) {",
        "  return str.length;",
        "}",
        "",
        "findLongestWordLength(\"The quick brown fox jumped over the lazy dog\");"
      ],
      "tests": [
        "assert(typeof findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") === \"number\", 'message: <code>findLongestWordLength(\"The quick brown fox jumped over the lazy dog\")</code> should return a number.');",
        "assert(findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") === 6, 'message: <code>findLongestWordLength(\"The quick brown fox jumped over the lazy dog\")</code> should return 6.');",
        "assert(findLongestWordLength(\"May the force be with you\") === 5, 'message: <code>findLongestWordLength(\"May the force be with you\")</code> should return 5.');",
        "assert(findLongestWordLength(\"Google do a barrel roll\") === 6, 'message: <code>findLongestWordLength(\"Google do a barrel roll\")</code> should return 6.');",
        "assert(findLongestWordLength(\"What is the average airspeed velocity of an unladen swallow\") === 8, 'message: <code>findLongestWordLength(\"What is the average airspeed velocity of an unladen swallow\")</code> should return 8.');",
        "assert(findLongestWordLength(\"What if we try a super-long word such as otorhinolaryngology\") === 19, 'message: <code>findLongestWordLength(\"What if we try a super-long word such as otorhinolaryngology\")</code> should return 19.');"
      ],
      "type": "bonfire",
      "isRequired": true,
      "solutions": [
        "function findLongestWordLength(str) {\n  return str.split(' ').sort((a, b) => b.length - a.length)[0].length;\n}\n\nfindLongestWordLength(\"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.org/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 palavra mais longa de uma string",
          "description": [
            "Retorne o tamanho da palavra mais longa da frase fornecida.",
            "Sua resposta deve ser um número.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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>.');",
        "assert.deepEqual(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]), [25, 48, 21, -3], 'message: <code>largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])</code> should return <code>[25, 48, 21, -3]</code>.');"
      ],
      "type": "bonfire",
      "isRequired": true,
      "solutions": [
        "function largestOfFour(arr) {\n  return arr.map(subArr => Math.max.apply(null, subArr));\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.org/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 de arrays",
          "description": [
            "Retorne um array contendo o maior número de cada sub-array fornecido. Para simplificar, o array fornecido conterá exatamente 4 sub-arrays.",
            "Lembre-se, você pode iterar por um array com um simples <code>for</code> e acessar cada membro do array com a sintaxe <code>arr[i]</code>.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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(\"Congratulation\", \"on\") === true, 'message: <code>confirmEnding(\"Congratulation\", \"on\")</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\"&#44; \"specification\"&#41;</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)) && !(/\\['endsWith'\\]/.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\nconfirmEnding(\"Bastian\", \"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.org/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 final",
          "description": [
            "Verifique se uma string (primeiro argumento, <code>str</code>) termina com a string alvo fornecida (segundo argumento, <code>target</code>).",
            "Esse desafio <em>pode</em> ser resolvido com o método <code>.endsWith()</code>, que foi introduzido na ES2015. Mas para o propósito desse desafio, nós gostaríamos que, ao invés dele, você usasse algum dos métodos de substring do JavaScript.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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>.');",
        "assert(!/\\.repeat/g.test(code), 'message: The built-in <code>repeat()</code>-method should not be used');"
      ],
      "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.org/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 uma string Repita uma string",
          "description": [
            "Repita uma string <code>str</code> dada (primeiro argumento) <code>num</code> vezes (segundo argumento). Retorne uma string vazia se <code>num</code> não for um número positivo.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.",
        "Remember to use <a href=\"http://forum.freecodecamp.org/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\", 8);"
      ],
      "tests": [
        "assert(truncateString(\"A-tisket a-tasket A green and yellow basket\", 8) === \"A-tisket...\", 'message: <code>truncateString(\"A-tisket a-tasket A green and yellow basket\", 8)</code> should return \"A-tisket...\".');",
        "assert(truncateString(\"Peter Piper picked a peck of pickled peppers\", 11) === \"Peter Piper...\", 'message: <code>truncateString(\"Peter Piper picked a peck of pickled peppers\", 11)</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 (num >= str.length) {\n    return str;\n  }\n\n  return str.slice(0, num) + '...';\n}\n\ntruncateString(\"A-tisket a-tasket A green and yellow basket\", 8);\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 \"...\".",
            "Recuerda utilizar <a href='http://forum.freecodecamp.org/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 uma string",
          "description": [
            "Trunque uma string (primeiro argumento) se ela for mais longa do que o comprimento máximo dado (segundo argumento). Retorne a string truncada com um <code>...</code> no final.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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) {",
        "  let num = 0;",
        "  return num;",
        "}",
        "",
        "findElement([1, 2, 3, 4], num => num % 2 === 0);"
      ],
      "solutions": [
        "function findElement(arr, func) {\n  let num;\n\n  arr.some(e => {\n    if (func(e)) {\n      num = e;\n      return true;\n    }\n  });\n\n  return num;\n}\n\nfindElement([1, 2, 3, 4], num => num % 2 === 0);\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.org/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": "Achado não é roubado",
          "description": [
            "Crie uma função que itera sobre um array (primeiro argumento) e retorna o primeiro elemento do array que retornar <code>true</code> para uma função de teste (segundo argumento). Se nenhum elemento passar no teste, retorne <code>undefined</code>.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se ficar travado. Escreva seu próprio 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.org/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.org/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  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.org/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": "Bu!",
          "description": [
            "Verifique se um valor é classificado como um primitivo booleano. Retorne <code>true</code> ou <code>false</code>.",
            "Primitivos booleanos são <code>true</code> e <code>false</code>.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se ficar travado. Tente programar em par. Escreva seu próprio 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.org/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.org/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&#39;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&#39;m a little tea pot\")</code> should return <code>I&#39;m A Little Tea Pot</code>.');",
        "assert(titleCase(\"sHoRt AnD sToUt\") === \"Short And Stout\", 'message: <code>titleCase(\"sHoRt AnD sToUt\")</code> should return <code>Short And Stout</code>.');",
        "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 <code>Here Is My Handle Here Is My Spout</code>.');"
      ],
      "type": "bonfire",
      "isRequired": true,
      "solutions": [
        "function titleCase(str) {\n  return str.split(' ').map(word => word.charAt(0).toUpperCase() + word.substring(1).toLowerCase()).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.org/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 Uma String Num Título",
          "description": [
            "Retorne a string fornecida com a primeira letra de cada palavra em maiúsculo. Certifique-se de que o resto da palavra esteja minúsculo.",
            "Para o propósito desse exercício, você também deve deixar maiúscula a primeira letra das palavras de ligação como \"the\" e \"of\".",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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": [
        "let testArr1 = [1, 2];",
        "let 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  let result = arr2.slice();\n  for (let 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": [
            "Você recebe dois arrays e um índice.",
            "Use os métodos de array <code>slice</code> e <code>splice</code> para copiar cada elemento do primeiro array para o segundo array, em ordem.",
            "Comece a inserir elementos no índice <code>n</code> do segundo array.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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>.",
        "Hint: Try converting each value to a Boolean.",
        "Remember to use <a href=\"http://forum.freecodecamp.org/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  return arr.filter(e => 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.org/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 um array.",
            "Valores falsos em JavaScript são <code>false</code>, <code>null</code>, <code>0</code>, <code>\"\"</code>, <code>undefined</code> e <code>NaN</code>.",
            "Dica: Tente converter cada valor para um booleano.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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(typeof(getIndexToIns([10, 20, 30, 40, 50], 35)) === \"number\", 'message: <code>getIndexToIns([10, 20, 30, 40, 50], 35)</code> should return a number.');",
        "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(typeof(getIndexToIns([10, 20, 30, 40, 50], 30)) === \"number\", 'message: <code>getIndexToIns([10, 20, 30, 40, 50], 30)</code> should return a number.');",
        "assert(getIndexToIns([40, 60], 50) === 1, 'message: <code>getIndexToIns([40, 60], 50)</code> should return <code>1</code>.');",
        "assert(typeof(getIndexToIns([40, 60], 50)) === \"number\", 'message: <code>getIndexToIns([40, 60], 50)</code> should return a number.');",
        "assert(getIndexToIns([3, 10, 5], 3) === 0, 'message: <code>getIndexToIns([3, 10, 5], 3)</code> should return <code>0</code>.');",
        "assert(typeof(getIndexToIns([3, 10, 5], 3)) === \"number\", 'message: <code>getIndexToIns([3, 10, 5], 3)</code> should return a number.');",
        "assert(getIndexToIns([5, 3, 20, 3], 5) === 2, 'message: <code>getIndexToIns([5, 3, 20, 3], 5)</code> should return <code>2</code>.');",
        "assert(typeof(getIndexToIns([5, 3, 20, 3], 5)) === \"number\", 'message: <code>getIndexToIns([5, 3, 20, 3], 5)</code> should return a number.');",
        "assert(getIndexToIns([2, 20, 10], 19) === 2, 'message: <code>getIndexToIns([2, 20, 10], 19)</code> should return <code>2</code>.');",
        "assert(typeof(getIndexToIns([2, 20, 10], 19)) === \"number\", 'message: <code>getIndexToIns([2, 20, 10], 19)</code> should return a number.');",
        "assert(getIndexToIns([2, 5, 10], 15) === 3, 'message: <code>getIndexToIns([2, 5, 10], 15)</code> should return <code>3</code>.');",
        "assert(typeof(getIndexToIns([2, 5, 10], 15)) === \"number\", 'message: <code>getIndexToIns([2, 5, 10], 15)</code> should return a number.');",
        "assert(getIndexToIns([], 1) === 0, 'message: <code>getIndexToIns([], 1)</code> should return <code>0</code>.');",
        "assert(typeof(getIndexToIns([], 1)) === \"number\", 'message: <code>getIndexToIns([], 1)</code> should return a number.');"
      ],
      "type": "bonfire",
      "isRequired": true,
      "solutions": [
        "function getIndexToIns(arr, num) {\n  arr = arr.sort((a, b) => a - b);\n\n  for (let i = 0; i < arr.length; i++) {\n    if (arr[i] >= num) {\n      return i;\n    }\n  }\n\n  return arr.length;\n}\n\ngetIndexToIns([40, 60], 50);\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.org/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": "Onde é meu lugar?",
          "description": [
            "Retorne o menor índice no qual um valor (segundo argumento) deve ser inserido num array (primeiro argumento) depois que ele foi ordenado. 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 <code>1.5</code> é maior 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, depois de ordenado, o array será <code>[3,5,20]</code> e <code>19</code> é menor que <code>20</code> (índice 2) e maior que <code>5</code> (index 1).",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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  let hash = Object.create(null);\n\n  arr[0].toLowerCase().split('').forEach(c => hash[c] = true);\n\n  return !arr[1].toLowerCase().split('').filter(c => !hash[c]).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.org/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 <code>true</code> se a string no primeiro elemento do array contiver todas as letras da string no segundo elemento do array.",
            "Por exemplo, para os argumentos <code>[\"hello\", \"Hello\"]</code>, sua função deve retornar <code>true</code>, porque todas as letras da segunda string estão presentes na primeira, ignorando maiúsculas e minúsculas.",
            "Para os argumentos <code>[\"hello\", \"hey\"]</code>, sua função deve retornar <code>false</code> porque a string \"hello\" não contém um \"y\".",
            "Finalmente, para <code>[\"Alien\", \"line\"]</code>, sua função deve retornar <code>true</code> porque todas as letras em \"line\" estão presentes em \"Alien\".",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se 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.org/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  let out = [];\n\n  for (let i = 0; i < arr.length; i += size) {\n    out.push(arr.slice(i, i + size));\n  }\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.org/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 função que divide um array (primeiro argumento) em grupos de comprimento <code>size</code> (segundo argumento) e retorna esses grupos num array bidimensional.",
            "Lembre-se de <a href=\"http://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Ler-Pesquisar-Perguntar</a> se ficar travado. Escreva seu próprio código."
          ]
        }
      }
    }
  ]
}
