Skip to main content
1-Visitor
April 11, 2020
Solved

ES6 syntax error: 'operator is only available in ES6 (use 'esversion: 6')'

  • April 11, 2020
  • 4 replies
  • 4666 views

Hello,

My platform version is ThingWorx 8.5.4-b222

 

In service I try to use spread operator:

 

 

const result = [...arr1, ...arr2];

 

 

 But I receive error:

 

 

'spread operator' is only avaiable in ES6 (use 'esversion: 6')

 

 

How can I fix it?

Thanks in advance.

Best answer by raluca_edu

Hi,

 

I don't think spread operator is supported, Thingworx 8.5.x is using Rhino Javascript Engine 1.7.11. 

See here a support table:

https://mozilla.github.io/rhino/compat/engines.html

 

Hope it helps,

Raluca Edu

4 replies

raluca_edu
17-Peridot
April 13, 2020

Hi,

 

Could you provide a code example to reproduce it?

 

Thanks,

Raluca Edu

1-Visitor
April 14, 2020

hi,

 

yes, sure:

 

const arr1 = [0, 1, 2];
const arr2 = [3, 4, 5];
let result = [...arr1, ...arr2];

 

 

raluca_edu
17-Peridot
April 14, 2020

Hi,

 

I don't think spread operator is supported, Thingworx 8.5.x is using Rhino Javascript Engine 1.7.11. 

See here a support table:

https://mozilla.github.io/rhino/compat/engines.html

 

Hope it helps,

Raluca Edu