tay-chi / loops-arrays-objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writing Loops with Arrays and Objects in JavaScript

Loops with Arrays

  • Arrays are ordered collections of elements. You can use loops to iterate through each element in an array.
const numbers = [1, 2, 3, 4, 5];

for (let i = 0; i < numbers.length; i++) {
  console.log(numbers[i]);
}

Loops with Objects

  • Objects are collections of key-value pairs. You can loop through objects in arrays (called collections).

  • Loops allow you to perform operations on each element or property of an array or object, making them powerful tools for processing and manipulating data in your JavaScript programs.

Prep

  1. Connect your js file to your HTML file
  2. Open your code in the browser and open your console

Activities

  1. In the js file, complete the list of exercises.

About


Languages

Language:JavaScript 94.2%Language:HTML 5.8%