Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
VMware vRealize Orchestrator Essentials

You're reading from   VMware vRealize Orchestrator Essentials Get hands-on experience with vRealize Orchestrator and automate your VMware environment

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781785884245
Length 184 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Daniel Langenhan Daniel Langenhan
Author Profile Icon Daniel Langenhan
Daniel Langenhan
Arrow right icon
View More author details
Toc

Working with arrays


We have already taken a look at different variable types, but there is a special type that we should explore a bit more—the array. Any variable type can be made into an array. An array is a container that holds multiple values of the same variable type. For example, an array of the String variable type may contain values such as "Mum", "Dad", "Sister", and "Brother", whereas an array of VC:VirtualMachine may contain multiple VMs.

Arrays in JavaScript

In JavaScript, you can use several methods to start, define, and initialize an array. The following are some of these methods:

  • By defining its content:

    var family = new Array("Mum", "Dad", "Sister", "Brother");
  • Using a more compact style:

    var family=["Mum", "Dad", "Sister", "Brother"];
  • Alternatively, if you want to initialize an empty array, just use the following:

    var family = new Array();
  • If you want to add an element to an array, you just push it in:

    family.push("Aunt");

Typically, we access the content of an array via JavaScript...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image