javascript runat server arrow functions not working

53 Views Asked by At

JavaScript runat=server

This function works fine:

function test() {
  var a = {
    "ar1": [1, 2, 3, 4, 5]
  };
  if (a.ar1.some(1)) {
    return true
  }
  return false
}

test();

This does not. I get a syntax error:

function test() {
var a={"ar1":[1,2,3,4,5]};
if(a.ar1.some(x=> x==1)){
       return true
}
return false
}

That same code works fine on the client side. Whenever I introduce an arrow function to my runat=server, I get an error.

Why?

0

There are 0 best solutions below