There is a variable:

var url = "https://domain.com/?a=111&b=222&c=333"; 

How to leave only domain.com in a variable?

    1 answer 1

    You can use the URL class

    And take the property hostname

     var url = "https://domain.com/?a=111&b=222&c=333"; var u = new URL(url); console.log(u.hostname);