Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

2.9. Arrays

At some point you're going to get the urge to be rebellious and store more than one value in a variable. I mean, those variables are just too damn restrictive, right? Fortunately, there is a perfect feature in JavaScript that allows you to continue your disruptive streak. That feature is the Array object.

Arrays (created using the Array object) are essentially containers that allow you to store multiple values. The great thing is that they're a data type, which means they can be assigned to variables, just like we've seen variables used with numbers and strings so far. So one variable with an Array object assigned to it can effectively hold countless values (known as elements) — pretty cool stuff!


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial