JSFiddle - React, Tailwind, and code Playground

JavaScript

function SiteProfile(_url) {
    //change the line below to:
    this.url = _url;
    //this.url = "";
    this.name = this.ExtractNameFromURL();
}

SiteProfile.prototype.ExtractNameFromURL = function() {
    var firstDOT = this.url.indexOf(".");
    var secondDOT = this.url.indexOf(".", firstDOT + 1);
    var theName = "";
    for (var i = firstDOT + 1; i < secondDOT; i++) {
        theName += this.url[i];
    }
    return theName;
}
var site = new SiteProfile("www.google.co.il");
document.write(site.name); // with the change above, this will behave as expected