console.log('After  :'+sentenceCase('PHP exercises. python exercises.'))

function sentenceCase(str)
{
    var temp = str.split('');
    var tem = [];
    console.log('Before :'+str);
    for(var i = 0 ; i<temp.length ; i++ )
    {
        if(temp[i] == temp[i].toLowerCase())
        {
           tem[i]= temp[i].toUpperCase();
        }
        else
        {
           tem[i]= temp[i].toLowerCase();
        }
    }
    return tem.join('')
}

Embed on website

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