diff --git a/seed/challenges/01-front-end-development-certification/basic-bonfires.json b/seed/challenges/01-front-end-development-certification/basic-bonfires.json index f5e920d35c..5b1fc120fb 100644 --- a/seed/challenges/01-front-end-development-certification/basic-bonfires.json +++ b/seed/challenges/01-front-end-development-certification/basic-bonfires.json @@ -529,49 +529,45 @@ } }, { - "id": "ab31c21b530c0dafa9e241ee", - "title": "Slasher Flick", + "id": "579e2a2c335b9d72dd32e05c", + "title": "Slice and Splice", "description": [ - "Return the remaining elements of an array after chopping off n elements from the head.", - "The head means the beginning of the array, or the zeroth index.", - "Remember to use Read-Search-Ask if you get stuck. Write your own code." + "You are given two arrays and an index.", + "Use the array methods slice and splice to copy each element of the first array into the second array, in order.", + "Begin inserting elements at index n of the second array.", + "Return the resulting array. The input arrays should remain the same after the function runs.", + "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ - "function slasher(arr, howMany) {", - " // it doesn't always pay to be first", - " return arr;", + "function frankenSplice(arr1, arr2, n) {", + " // It's alive. It's alive!", + " return arr2;", "}", "", - "slasher([1, 2, 3], 2);" + "frankenSplice([1, 2, 3], [4, 5, 6], 1);" + ], + "tail": [ + "var testArr1 = [1, 2];", + "var testArr2 = ['a', 'b'];" ], "tests": [ - "assert.deepEqual(slasher([1, 2, 3], 2), [3], 'message: slasher([1, 2, 3], 2) should return [3].');", - "assert.deepEqual(slasher([1, 2, 3], 0), [1, 2, 3], 'message: slasher([1, 2, 3], 0) should return [1, 2, 3].');", - "assert.deepEqual(slasher([1, 2, 3], 9), [], 'message: slasher([1, 2, 3], 9) should return [].');", - "assert.deepEqual(slasher([1, 2, 3], 4), [], 'message: slasher([1, 2, 3], 4) should return [].');", - "assert.deepEqual(slasher(['burgers', 'fries', 'shake'], 1), ['fries', 'shake'], 'message: slasher([\"burgers\", \"fries\", \"shake\"], 1) should return [\"fries\", \"shake\"].');", - "assert.deepEqual(slasher([1, 2, 'chicken', 3, 'potatoes', 'cheese', 4], 5), ['cheese', 4], 'message: slasher([1, 2, \"chicken\", 3, \"potatoes\", \"cheese\", 4], 5) should return [\"cheese\", 4].');" + "assert.deepEqual(frankenSplice([1, 2, 3], [4, 5], 1), [4, 1, 2, 3, 5], 'message: frankenSplice([1, 2, 3], [4, 5], 1) should return [4, 1, 2, 3, 5].');", + "assert.deepEqual(frankenSplice(testArr1, testArr2, 1), ['a', 1, 2, 'b'], 'message: frankenSplice([1, 2], [\"a\", \"b\"], 1) should return [\"a\", 1, 2, \"b\"].');", + "assert.deepEqual(frankenSplice(['claw', 'tentacle'], ['head', 'shoulders', 'knees', 'toes'], 2), ['head', 'shoulders', 'claw', 'tentacle', 'knees', 'toes'], 'message: frankenSplice([\"claw\", \"tentacle\"], [\"head\", \"shoulders\", \"knees\", \"toes\"], 2) should return [\"head\", \"shoulders\", \"claw\", \"tentacle\", \"knees\", \"toes\"].');", + "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, "solutions": [ - "function slasher(arr, howMany) {\n // it doesn't always pay to be first\n return arr.slice(howMany);\n}\n\nslasher([1, 2, 3], 2);\n" + "function 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": { - "es": { - "title": "Vuélale la cabeza", - "description": [ - "Crea una función que devuelva los elementos restantes de un arreglo después de eliminar n elementos de la cabeza.", - "Por cabeza nos referimos al inicio de un arreglo, comenzando por el índice 0.", - "Recuerda utilizar Leer-Buscar-Preguntar si te sientes atascado. Intenta programar en pareja. Escribe tu propio código." - ] - } - } + "challengeType": 5 }, { "id": "af2170cad53daa0770fabdea",