JavaScript complex variables
In this recipe, we will have a look at JavaScript complex variables, such as arrays, objects, and properties. All these are needed to deal with plugin return codes such as from REST calls.
Getting ready
We need a new workflow and a scriptable task inside it to try it out.
The example workflow 06.01 JavaScript complex variables
contains all the examples that follow.
How to do it...
We will look into several different JavaScript complex variable type pieces.
Arrays
Arrays are pretty useful for storing multiple elements of the same type:
- To define a new empty array in JavaScript, use either one of the following codes:
var family = new Array();
var myArray = [];
- You can define a new filled array by using either of the following examples:
var family = new Array("Father","Mother","Daughter","Son");
var myArray = ["Father","Mother","Daughter","Son"];
- While accessing the element (numbering starts at zero...