Desafio: Modificando Arrays
Tarefa
Você recebe dois arrays. Sua tarefa é remover o primeiro e o último elemento de cada um dos arrays e, em seguida, exibir o array combinado na tela. Utilize os métodos apresentados nesta seção. Se tiver dificuldade para entender a tarefa, utilize os botões Dica e Solução para visualizar e analisar a solução.
Dessa forma, você assimilará melhor as informações.
12345678let firstArray: (number | string)[] = [0, 1, 2, 3, 4, 5]; let secondArray: (number | string)[] = ['zero', 'one', 'two', 'three', 'four', 'five'] firstArray.___(); //removing the last element secondArray.___(); //removing the last element firstArray.___(); //removing the first element secondArray.___(); //removing the first element let mixedArray: (___ | ___)[] = firstArray.___(___); //mixing two arrays into one console.log(mixedArray); // printing mixed array
Obrigado pelo seu feedback!
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Awesome!
Completion rate improved to 2.94
Desafio: Modificando Arrays
Deslize para mostrar o menu
Tarefa
Você recebe dois arrays. Sua tarefa é remover o primeiro e o último elemento de cada um dos arrays e, em seguida, exibir o array combinado na tela. Utilize os métodos apresentados nesta seção. Se tiver dificuldade para entender a tarefa, utilize os botões Dica e Solução para visualizar e analisar a solução.
Dessa forma, você assimilará melhor as informações.
12345678let firstArray: (number | string)[] = [0, 1, 2, 3, 4, 5]; let secondArray: (number | string)[] = ['zero', 'one', 'two', 'three', 'four', 'five'] firstArray.___(); //removing the last element secondArray.___(); //removing the last element firstArray.___(); //removing the first element secondArray.___(); //removing the first element let mixedArray: (___ | ___)[] = firstArray.___(___); //mixing two arrays into one console.log(mixedArray); // printing mixed array
Obrigado pelo seu feedback!