console.log(string_parameterize("Robin Singh from USA."));

function string_parameterize(str)
{
    var temp = str.split('');

    var ar = [];
    for(var i = 0 ; i < temp.length ; i++)
    {
      
        if(temp[i] == ' ')
        {
            ar[i]='-';
            continue
        }
         ar.push(temp[i])
    }
    return ar.join('').toLowerCase()
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: