0

javascript code:

 getParameterByName(name, url) {
        if (!url) url = window.location.href;
        name = name.replace(/[\[\]]/g, "\\$&");
        console.log(name);
        let regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
        let results = regex.exec(url);
        console.log(results)
        if (!results) return null;
        if (!results[2]) return '';
        return decodeURIComponent(results[2].replace(/\+/g, " "));
  }

I an unable to understand what this code will print for name and results and what will it be returning.

prasanth
  • 22,145
  • 4
  • 29
  • 53
parag badala
  • 776
  • 6
  • 5

0 Answers0