Javascript failure with Javascript runtime error: "SyntaxError: Unexpected token: . (Extract-EC-Key.js:4)"

I have a javascript to extract the single key from set of keys that has use == enc && !expired = true but the javascript was able to fetch the list of full json rsa keys from service callout response but failing suddenly stating . its in apigee edge.
Javascript runtime error: “SyntaxError: Unexpected token: . (Extract-EC-Key.js:4)”
Javascript:
var response = context.getVariable(“ServiceCallout.response”);
var json = JSON.parse(response);
var keys = json.keys;

const keysArray = keys.reduce((acc, item)=>{
if (item.use === “enc” && !item.expired) {
acc.push(item);
}

return acc;

},[])

context.setVariable(“keysArray”, JSON.stringify(keysArray[0]));

Does apigee edge support const and reduce with =>{} function because apigee javascript uses rhino javascript engine 1.7.12

@Dino @dchiesa1 Can you let me know the reason for failing and the fix.

Welcome back to the community @Nikhil_Dupati!

We encourage our community of developers who may have encountered similar challenges to share their thoughts. While we wait, you might find this recording from our community TechTalks helpful:

We’re going to keep this thread on our radar and encourage others in the community to pitch in. Thanks for reaching out to the community!

Hi @Nikhil_Dupati - Rino doesn’t support that, you can use Gemini to convert the code to ES5 that Rino can understand.. If you need modern ES6-ES8 features, then you can put your code in a Cloud Run and call it from Apigee.