Skip to main content

Command Palette

Search for a command to run...

Arrays

Published
โ€ข1 min readโ€ขView as Markdown
Arrays

Arrays are special kind of data which can hold many values

How we can create an array ?

  1. using an array literal []

  2. using the new keyword

creating an array using array literal [] Screenshot 2022-09-10 233018.png

creating an array using new keyword

Screenshot 2022-09-10 233457.png

you can store different data types in an array

Screenshot 2022-09-10 233842.png

you can also store functions and other objects inside an array

image.png

Accessing Array elements

array index starts from 0,1,2,3,.......so on based on the size of the array we can access array elements the last element in the array will Array[Size - 1]

Screenshot 2022-09-10 235511.png

A

Thanks, it was a good read, bookmarked, and followed!

1
G
Ganesh3y ago

Hey thanks ๐Ÿ™๐Ÿป๐Ÿ’–