location origin js example

JavaScript
console.log(window.location.origin);
Source

Also in JavaScript: