0

// Array Utils
  var firstArray= ['Green','Brown','Red','Orange','Yellow','Orange'];
var secondArray=['Purple','Black','Green','Blue','Orange'];
var thirdArray=['White','Orange','Green','pink'];
var demoObject={name:'Bean Plant',color:'Green',vegetable:'Beans'};
var arrayUtil=new ArrayUtil();
  // Merge two arrays
gs.info(arrayUtil.concat(firstArray,secondArray));
  // Check array contains the required value or not
gs.info(arrayUtil.contains(firstArray,'Yellow'));
  // Find out all the different values required array contain in comparision with other
gs.info(arrayUtil.diff(firstArray,secondArray,thirdArray));
  // Find out the index or position of an element in an array
gs.info(arrayUtil.indexOf(firstArray,'Orange',2));
  // find out only common values in all the array available.
gs.info(arrayUtil.intersect(firstArray,secondArray,thirdArray));
  // find out all the unique elements or values available in all the available array
var fourthArray=arrayUtil.union(firstArray,secondArray,thirdArray);
gs.info(fourthArray);
  // Find out the unique value available in an single array or required array
gs.info(arrayUtil.unique(firstArray));
  // Convert Javascript object to javascript array
gs.info(Array.isArray(demoObject));
gs.info(arrayUtil.ensureArray(demoObject));
gs.info(JSON.stringify(arrayUtil.ensureArray(demoObject)));

Below is the Code exploring some method of ArrayUtil
Working Code Edited question May 2, 2024