var url2 = 'https://detail.tmall.com/item.htm?id=638005051622&rn=75d4c727a775b386c6e5b47414d6153c&abbucket=9'; var temp2 = url2.split('?')[1]; var pram2 = new URLSearchParams('?'+temp2); console.log(pram2.get('id')); console.log(temp2);