Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Array Methods and Manipulation | Variables and Data Types in JavaScript
Introduction to JavaScript
course content

Conteúdo do Curso

Introduction to JavaScript

Introduction to JavaScript

1. JavaScript Fundamentals
2. Variables and Data Types in JavaScript
3. Performing Operations in JavaScript
4. Controlling Program Flow with Conditional Statements
5. Looping Through Data in JavaScript
6. Functions in JavaScript

book
Array Methods and Manipulation

1234567
let arr = [1, 2, 3]; arr.push(4); arr.push(5); arr.push(6); console.log(arr);
copy
123456
let arr = [1, 2, 3]; console.log("Array:", arr); arr.unshift(222); // Insert element at the start console.log("Array:", arr);
copy
123456
let arr = [1, 2]; arr[2] = 3; arr[3] = 4; console.log(arr);
copy
12345
let arr = [1, 2, 3]; arr[0] = 4; console.log("Array:", arr);
copy
12345678910111213
let myArray = []; myArray[myArray.length] = "indexing"; console.log("After first indexing:", myArray); myArray.push("pushing"); console.log("After first pushing:", myArray); myArray[myArray.length] = "indexing"; console.log("After second indexing:", myArray); myArray.push("pushing"); console.log("After second pushing:", myArray);
copy
1234567
let arr = [11, 22, 33, 44]; console.log("Array:", arr); let x = arr.pop(); // Remove and save the last element in `arr` to variable `x` console.log("Popped element:", x); console.log("Array now:", arr);
copy
123456789101112
let arr = [11, 22, 33, 44, 55, 66]; console.log("Array:", arr); let popped = arr.pop(); // Remove the last element console.log("Popped:", popped); console.log("Array:", arr); let shifted = arr.shift(); // Remove the first element console.log("Shifted:", shifted); console.log("Array:", arr);
copy
question mark

Select the correct answer

question mark

Select the correct answer

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 7

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

course content

Conteúdo do Curso

Introduction to JavaScript

Introduction to JavaScript

1. JavaScript Fundamentals
2. Variables and Data Types in JavaScript
3. Performing Operations in JavaScript
4. Controlling Program Flow with Conditional Statements
5. Looping Through Data in JavaScript
6. Functions in JavaScript

book
Array Methods and Manipulation

1234567
let arr = [1, 2, 3]; arr.push(4); arr.push(5); arr.push(6); console.log(arr);
copy
123456
let arr = [1, 2, 3]; console.log("Array:", arr); arr.unshift(222); // Insert element at the start console.log("Array:", arr);
copy
123456
let arr = [1, 2]; arr[2] = 3; arr[3] = 4; console.log(arr);
copy
12345
let arr = [1, 2, 3]; arr[0] = 4; console.log("Array:", arr);
copy
12345678910111213
let myArray = []; myArray[myArray.length] = "indexing"; console.log("After first indexing:", myArray); myArray.push("pushing"); console.log("After first pushing:", myArray); myArray[myArray.length] = "indexing"; console.log("After second indexing:", myArray); myArray.push("pushing"); console.log("After second pushing:", myArray);
copy
1234567
let arr = [11, 22, 33, 44]; console.log("Array:", arr); let x = arr.pop(); // Remove and save the last element in `arr` to variable `x` console.log("Popped element:", x); console.log("Array now:", arr);
copy
123456789101112
let arr = [11, 22, 33, 44, 55, 66]; console.log("Array:", arr); let popped = arr.pop(); // Remove the last element console.log("Popped:", popped); console.log("Array:", arr); let shifted = arr.shift(); // Remove the first element console.log("Shifted:", shifted); console.log("Array:", arr);
copy
question mark

Select the correct answer

question mark

Select the correct answer

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 7
some-alt