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:


This content originally appeared on DEV Community and was authored by DevCronin

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];

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]
];

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

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

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


This content originally appeared on DEV Community and was authored by DevCronin


Print Share Comment Cite Upload Translate Updates
APA

DevCronin | Sciencx (2021-09-19T20:22:55+00:00) LEVEL UP with JavaScript! LVL 7. Retrieved from https://www.scien.cx/2021/09/19/level-up-with-javascript-lvl-7/

MLA
" » LEVEL UP with JavaScript! LVL 7." DevCronin | Sciencx - Sunday September 19, 2021, https://www.scien.cx/2021/09/19/level-up-with-javascript-lvl-7/
HARVARD
DevCronin | Sciencx Sunday September 19, 2021 » LEVEL UP with JavaScript! LVL 7., viewed ,<https://www.scien.cx/2021/09/19/level-up-with-javascript-lvl-7/>
VANCOUVER
DevCronin | Sciencx - » LEVEL UP with JavaScript! LVL 7. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/19/level-up-with-javascript-lvl-7/
CHICAGO
" » LEVEL UP with JavaScript! LVL 7." DevCronin | Sciencx - Accessed . https://www.scien.cx/2021/09/19/level-up-with-javascript-lvl-7/
IEEE
" » LEVEL UP with JavaScript! LVL 7." DevCronin | Sciencx [Online]. Available: https://www.scien.cx/2021/09/19/level-up-with-javascript-lvl-7/. [Accessed: ]
rf:citation
» LEVEL UP with JavaScript! LVL 7 | DevCronin | Sciencx | https://www.scien.cx/2021/09/19/level-up-with-javascript-lvl-7/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.