Défi : Modification des Tableaux
Tâche
Deux tableaux vous sont donnés. L'objectif est de supprimer le premier et le dernier élément de chacun des tableaux, puis d'afficher le tableau combiné à l'écran. Utilisez les méthodes abordées dans cette section. En cas de difficulté à comprendre la tâche, il est possible d'utiliser les boutons Indice et Solution pour consulter et analyser la solution.
Cela facilitera une meilleure compréhension des informations.
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
Merci pour vos commentaires !
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
What methods should I use to remove the first and last elements from an array?
How do I combine two arrays into one in TypeScript?
Can you explain what the final mixedArray will look like after these operations?
Awesome!
Completion rate improved to 2.94
Défi : Modification des Tableaux
Glissez pour afficher le menu
Tâche
Deux tableaux vous sont donnés. L'objectif est de supprimer le premier et le dernier élément de chacun des tableaux, puis d'afficher le tableau combiné à l'écran. Utilisez les méthodes abordées dans cette section. En cas de difficulté à comprendre la tâche, il est possible d'utiliser les boutons Indice et Solution pour consulter et analyser la solution.
Cela facilitera une meilleure compréhension des informations.
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
Merci pour vos commentaires !