console.log(string_endsWith('JS PHP JaVa','JaVa'));
console.log(string_endsWith('JS PHP PYTHON','PYTHON'));
console.log(string_endsWith('JS PHP js','Js'));
function string_endsWith(str,spc)
{
    var arr = str;
    var temp = [];
    for(var i = arr.length-1 ; i>0 ; i--)
    {
        if(arr[i] == ' ')
        {
            break
        }
        
        temp.push(arr[i]);
    }
    var temp1 =temp.reverse().join('')
    if(spc === temp1)
    {
        return true;
    }
    else
    {
        return false;
    }

}

Embed on website

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