Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

275
Visualizações
Hay seis funciones, lea cada comentario y escriba las declaraciones de retorno para cada uno de ellos

Hola a todos, espero poder obtener ayuda aquí y alguien puede explicarme esto. Estoy en una clase de codificación y no puedo resolver esto por mi vida. Este es el código que necesito para terminar. Parece que no puedo hacer esto bien. ¿Alguien puede ayudar? Intenté agregar las líneas de código necesarias de varias maneras diferentes, así que finalmente reinicié todo y estoy perdido.

 // Instructions // - Given the following 6 empty functions, add the right return statement to each of them to complete the activity // Please do not change any of the function names //This is your starting array const arr = [10, 10, 16, 12]; function returnFirst(arr) { // return the first item from the array } function returnLast(arr) { // return the last item of the array } function getArrayLength(arr) { // return the length of the array } function incrementByOne(arr) { // arr is an array of integers(numbers), Increment all items in the array by // return the array } function addItemToArray(arr, item) { // add the parameter item to the end of the array arr // return the array } function addItemToFront(arr, item) { // add the parameter item to the front of the array arr // return the array // hint: use the array method .unshift } //uncomment these lines to check results in browser console // console.log("returnFirst result:" + returnFirst(arr)) // console.log("returnLast result:" + returnLast(arr)) // console.log("getArrayLength result:" + getArrayLength(arr)) // console.log("incrementByOne result:" + incrementByOne(arr)) // console.log("addItemToArray result:" + addItemToArray(arr, 10)) // console.log("addItemToFront result:" + addItemToFront(arr, 10)) ////////////////////////////////// //don't change this line if (typeof module !== 'undefined') { module.exports = { returnFirst, returnLast, getArrayLength, incrementByOne, addItemToArray, addItemToFront, }; }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

No dices qué idioma es este, pero supongo que es javascript. La pregunta le pide que encuentre la sintaxis para leer o manipular la matriz inicial y etiquetarla al final de una declaración de devolución. Entonces, la primera respuesta podría ser algo como: return arr[0] , que debería mostrar el primer elemento (sin índice) en la matriz. Toda la función entonces se ve así:

 function returnFirst(arr) { // return the first item from the array return arr[0]; }
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda