var testStr = "hello_1"; var result = testStr.substring(testStr.length-1,testStr.length); console.log(result) var result1 = testStr.substr(testStr.length - 1,1); console.log(result1)