Why am I getting the error "Uncaught TypeError: st.replace is not a function"
<p>I trying to build a portfolio. I am not a javascript expert and am not sure what to remove, or what is at fault. The page works fine but as soon as I try to go to the homepage the exit is very slow and the console throws an error.</p>

<p><em>"Uncaught TypeError: st.replace is not a function"</em></p>

<p>This snippet below is the piece that is faulty and gives me the error as soon as I click the home button to navigate away from the 'services' page. </p>

<p>Any instructions to as what is incorrect in the snippet are appreciated, thank you.</p>

<pre><code>            htmlDoc: function(st) {
                var n, i = e(),
                    r = /&lt;(\/?)(html|head|body|title|base|meta)(\s+[^&gt;]*)?&gt;/gi,
                    o = "ss" + Math.round(1e5 * Math.random()),
                    a = st.replace(r, function(t, n, r, a) {
                        var s = {};
                        return n || (e.merge(i, e("&lt;" + r + "/&gt;")), a &amp;&amp; e.each(e("&lt;div" + a + "/&gt;")[0].attributes, function(e, t) {
                            s[t.name] = t.value
                        }), i.eq(-1).attr(s)), "&lt;" + n + "div" + (n ? "" : ' id="' + o + (i.length - 1) + '"') + "&gt;"
                    });
                return i.length ? (n || (n = e("&lt;div/&gt;")), n.html(a), e.each(i, function(e) {
                    var t = n.find("#" + o + e).before(i[e]);
                    i.eq(e).html(t.contents()), t.remove()
                }), n.children().unwrap()) : e(t)
            },
</code></pre>

<p><strong>EDIT FelixKling</strong></p>

<p>Thanks, @FelixKling Is seems to have several values: </p>

<p>"st = /-([\da-z])/gi," </p>

<p>and </p>

<p>" st = ":(" + rt + ")(?:((('((?:\\.|[^\\'])<em>)'|\"((?:\\.|[^\\\"])</em>)\")|((?:\\.|[^\()[]]|" + at + ")<em>)|.</em>))|)", " </p>

<p>and </p>

<p>" St = ["Top", "Right", "Bottom", "Left"], " </p>

<p>but the last one has a Capital letter S. Please copy paste this answer to read it more cleartly. If i need to explain some more please let me know. </p>