• I also have problems with the tests

Question related to mission None

 

Local test are running correct and complete, but server returns error after clicking 'check': Can someone help me to fix this problem?

"use strict";

function mostWanted(data) {
  const d = data.toLowerCase().split('').sort().join('');
  let regexp = /(?=([a-z]))\1{1,}/g;
  let matchesArr = d.match(regexp);

  matchesArr.sort((a, b) => {
    return b.length - a.length;
  });

  return matchesArr[0][0];
}

var assert = require('assert');

if (!global.is_checking) {
    assert.equal(mostWanted("Hello World!"), "l", "1st example");
    assert.equal(mostWanted("How do you do?"), "o", "2nd example");
    assert.equal(mostWanted("One"), "e", "3rd example");
    assert.equal(mostWanted("Oops!"), "o", "4th example");
    assert.equal(mostWanted("AAaooo!!!!"), "a", "Letters");
    console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}