Today, I think AI editors like ChatGPT etc would be the best bet for converting ES6+ code to ES5 vRO compatible code (looked for my transpilers but none suited my\your requirement). Also, ask the editor to change console.log() with System.log(). Additionally, avoid forEach() in your code as it is deprecated.

Mark as Resolve if it answers your query. Thanks. Helps me collect points.
Original Message:
Sent: Jul 07, 2025 09:48 AM
From: Michael Cornn
Subject: JavaScript comparing two arrays. include() function is not present?
Thanks for the information, and that's a great blog. I'm looking at your other posts now.
That's a shame less than half of the ECMA standard is supported. I'm already a novice with JavaScript, and now I'm entering a minefield of missing features. :(
Given that includes() is not available, how would you write a snippet comparing two arrays? Here's a sample of the code I tried to write. list1 has 5 items. 2 of the items ('server3' and 'server5') are not in list2. I want to create a new array with items that are in list1 but not list2 (then assign that to a variable in a workflow).
This should work in vanilla JS. How can I adapt it to work in Rhino/vRO?
var list1 = ['Server1','Server2','Server3','Server4','Server5'];
var list2 = ['Server1','Server2','Server4','Server6','Server7'];
var different = new Array();
list1.foreach((element) => {
if (!list2.includes(item)){
different.push(item);
}
});
Original Message:
Sent: Jul 04, 2025 03:20 AM
From: mayank_goyal
Subject: JavaScript comparing two arrays. include() function is not present?
Your question is very valid. vRO upto 8.18.x uses Rhino Engine 1.7R4 which loosely implements JavaScript 1.7 and ECMAScript 5.1+ and it doesn't have includes() function. However indexOf() is supported. The only problem in your code is the way you calling indexof instead of indexOf.
Read more here:
https://cloudblogger.co.in/2022/12/02/inside-vros-javascript-engine-rhino-1-7r4-cb10102/
https://mozilla.github.io/rhino/compat/engines.html -> Look for 1.7R4
Original Message:
Sent: Jul 03, 2025 12:04 PM
From: Michael Cornn
Subject: JavaScript comparing two arrays. include() function is not present?
I'm not well-versed in JavaScript, but it looks like some common JavaScript features aren't available in Aria Automation's implementation.
Take this snippet in a JavaScript action:
var list1 = ['Server1','Server2','Server3'];
System.log(Array.isArray(list1));
System.log( list1.indexof('Server1') );
System.loog( list1.includes('Server1') );
On line 1, variable "list1" is initialized as an array of Strings.
On line 2, we confirm that "list1" is indeed an array. It is; this line returns True.
On line 3, we get the index of an element. This line errors out with "cannot find function indexof".
If we comment out line 3, then line 4 also errors out with "cannot find function includes".
Why are these lines of code failing? Have I formatted something incorrectly? Or is there something unusual about Automation Orchestrator's implementation of JS?