console.log(swapcase('AaBbc'));

function swapcase(str)
{
    var temp = str.split('')
    var ar=[]
    for(var i =0 ; i< temp.length ; i++)
    {
        if(temp[i] == temp[i].toLowerCase())
        {
            ar[i]=temp[i].toUpperCase();
        }
        else
        {
            ar[i]=temp[i].toLowerCase();
        }
    }
    return ar.join('')
}

Embed on website

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