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"]; ...
Get VMware vRealize Orchestrator Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.