get the base url from a url in javascript code example
Example 1: js get base url
var url = window.location.origin;
Example 2: javascript get base url
console.log(window.location.origin);
var url = window.location.origin;
console.log(window.location.origin);