DEV Community

Cover image for LEVEL UP with JavaScript! LVL 7
DevCronin
DevCronin

Posted on

9 2

LEVEL UP with JavaScript! LVL 7

In this blog series tutorial, I will be covering some of the basic JavaScript programming concepts.

This is geared toward beginners and anyone looking to refresh their knowledge.

See the Previous Level Here

Level 7 will cover:

  • Store Multiple Values in One Variable Using JavaScript Arrays
  • Nest One Array Within Another Array
  • Access Array Data With Indexes
  • Modify Array Data

Store Multiple Values in One Variable Using JavaScript Arrays

Multiple values can be stored together by enclosing them with brackets [].
These can be any combination of strings and/or numbers.


let myArr = ["Natural", 20];

Enter fullscreen mode Exit fullscreen mode

Nest One Array Within Another Array

Nesting arrays within another array is also possible by using brackets inside of brackets.
This is referred to as multi-dimensional array.


let multiDimensionalArray = [
    ["Hit points", 30], 
    ["Damage", 15]
];

Enter fullscreen mode Exit fullscreen mode

Access Array Data With Indexes

Indexes are a way to reference and then access data inside of an array.
They use brackets and specify an entry in an array.
Arrays use Zero-based indexing (starts the count from zero).


let diceArray = [2,5,6,4,1,1];

diceArray[3];

// 4

Enter fullscreen mode Exit fullscreen mode

Modify Array Data

The entries of arrays are able to be changed, and this is referred to as mutable.


let diceArray = [2,10,8,7];

diceArray[0] = 4;

diceArray[0];

// 4

// Now the 2 in our array is 4

Enter fullscreen mode Exit fullscreen mode

Thank you for reading my blog! This is the seventh of my series on JavaScript so if you would like to read more, please follow!

See the Next Level Here

Support and Buy me a Coffee

AWS Q Developer image

Your AI Code Assistant

Implement features, document your code, or refactor your projects.
Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (5)

Collapse
 
peppeg85 profile image
peppeg85

sorry but....where is the level UP

Collapse
 
devcronin profile image
DevCronin

*geared toward beginners

Collapse
 
peppeg85 profile image
peppeg85

ok, sorry, i read level up and thinked it was an advanced level post

Thread Thread
 
devcronin profile image
DevCronin

Its okay, I am still a beginner myself.

Collapse
 
apassiondev profile image
Andrey Ho

I wish beginners would be given more helpful information. It's even impractical in every aspect.

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay