SyntaxError: illegal character U+2212

I have on my console:

SyntaxError: illegal character U+2212

So I need help to fix the issue.

My code so far:

const arr = [2, 1, 100, 56, 78, 3, 66, 99, 200, 46];
const calculateWeight = (num, sum = 0) => {
      return calculateWeight(Math.floor(num / 10), sum + (num % 10));
   return sum;
const sorter = (a, b) => {
   return calculateWeight(a) − calculateWeight(b) || (a - b);

Here is a picture of the issue:

if you have copied the code you may have an invisible character accidentally stuck in there. I suggest deleting the line completely and tipying it again

If you google U+2212 you can see that u+2212 is a Unicode minus sign. One of the two minus signs is a special character. Try deleting and re-typing those.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.