cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
511
Views
1
Helpful
1
Replies

Evaluate Node - JavaScript error

Gerry O'Rourke
Spotlight
Spotlight

Anyone have any ideas why this gives an error in an webex connect evaluate node?

 

const originalArray = ["apple", "orange", "banana"];
const formattedArray = originalArray.map(fruit => ({ fruit }));
const myJson = JSON.stringify(formattedArray);
1;

 

It fails on line 2 - syntax error (<cmd>#2)

But the JavaScript looks OK? and the variable myJson should evaluate to:

 

[{"fruit":"apple"},{"fruit":"orange"},{"fruit":"banana"}]

 

Regards,

Gerry

1 Reply 1

Connect - Tanuj
Cisco Employee
Cisco Employee

Hi @Gerry O'Rourke - Arrow function is not supported by the JavaScript engine used for Webex Connect Evaluate node. You will need to define a function on your own to do the required data transformation/structuring in this case.

Tanuj Goyal
Webex Connect