Creating an Array
To create an array we use something called bracket syntax. It's more formally known as an array literal or array initializer and looks like this:
elementN
is the list of values for the array's elements.
We'll use an example of an employee list to cover some basic things regarding arrays.
Your console window should look like this:
Let's discuss the parts of our array:
array name -
emp
elements -
emp[0]
,emp[1]
, andemp[2]
element values -
'Joe King'
,'Amanda Huggenkiss'
, and'Justin Thyme'
Fun fact: We could have populated our array at the same time we created it!
Last updated