var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return b - a});
Above is my code. I am using the Khanacademy.com interface to make a program where the computer is give an array of numbers and it sorts them into ascending order. However, an error keeps coming up even though I copied this off a website and this method of sorting in JavaScript has been repeatedly stated across many websites.
The error that continues to appear states, "Did you forget to add a comma between two parameters?" Whenever I ask it to show me where, it always places my cursor here:
points.sort(function(a, b){return b - a});
^
Can someone please tell me what is wrong with my code? Or if you have a better way of sorting numbers, I am fine with that, too.