DEV Community

Jemima M
Jemima M

Posted on

Adventofcode 🎄: Day 11 - Arrays

Happy December 11th!! Let's see what we have for advent of code today....

Arrays!!

In Javascript, an array is a versatile global object (object that is accessible globally in any part of your code) designed for storing data. Arrays function as ordered collections or lists, accommodating zero or more data types. They employ numerical indices, starting from 0, to precisely access individual items within the array.

Numerous array methods are available in JavaScript, and one particularly powerful one in the context of React is the .map() method.

This method empowers you to execute a function on each element within the array, producing a new array as the outcome. In React, the .map() method finds a valuable application in creating lists dynamically.

Here is an example:

const myArray = ['kiwi', 'raspberry', 'orange'];

const myList = myArray.map((item) => <p>{item}</p>)
Enter fullscreen mode Exit fullscreen mode

I hope that this short revision of arrays has helped, in the meantime...KEEP CODING!!

Top comments (0)