Javascript decodeURIComponent() decode URL query parameters

Description

Javascript decodeURIComponent() decode URL query parameters

function decodeQueryParam(p) {
   return decodeURIComponent(p.replace(/\+/g, ' '));
}

let a = decodeQueryParam('search+query%20%28test%29');
console.log(a);//from ww w .j a  v  a2 s. c o  m



PreviousNext

Related