0

I am sorting an Array with Javascript and it is working fine in Chrome, Firefox, Safari but in IE11 I am getting a syntax error. Anyone know what could be causing this? Here's my sort function:

arr.sort((a, b) => b - a);

1 Answer 1

1

Internet Explorer 11 does not support the ES2015 feature Arrow Functions.

Either use the function syntax or incorporate a transpiler such as Babel or TypeScript into your toolchain.

Your code as transpiled by Babel

Your code as transpiled by TypeScript

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the explanation, function worked great!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.