Newbie on javascript : <p>A friend of mine sent me a link to a webpage that looks like a scam, and there is a button that you press to "play a video". I'm don't know a lot about javascript and I was wondering if anybody could tell me what is the purpose of the web. Here is the js code attached to it:</p>

<pre><code>function generateRandomString(iLen) {
        var sRnd = "";
        var sChrs = "abcdefghiklmnopqrstuvwxyz";
        for (var i = 0; i &lt; iLen; i++) {
          var randomPoz = Math.floor(Math.random() * sChrs.length);
          sRnd += sChrs.substring(randomPoz, randomPoz + 1);
        }
        return sRnd;
      }

    function getUrlVars() {
        var vars = {};
        var parts = window.location.href.replace(/[?&amp;]+([^=&amp;]+)=([^&amp;]*)/gi, function(m,key,value) {
            vars[key] = value;
        });
        return vars;
    }
    var id = getUrlVars()["id"];
    var name = getUrlVars()["name"];
    var wkr = getUrlVars()["wkr"];
    function visitPage(){
            window.location = "https://smarturl.it/blogredirect/?1579793560&amp;wkr=jsr&amp;id="+id+"&amp;name="+name;
        }

            if (screen.width &lt;= 720) {
            window.location = "https://smarturl.it/blogredirect/?1579793560&amp;wkr=jsr&amp;id="+id+"&amp;name="+name;
        } else {
           document.getElementById("demo").innerHTML ="&lt;h1&gt;&lt;button class=button onclick=visitPage();&gt; Watch Video&lt;/button&gt;&lt;/h1&gt;"
        }
</code></pre>
