Last character substring

JavaScript

var t = "hello world";
alert(t.substr(t.length-1, 4));