var myString = "this.is.my.file.txt" alert(myString.substring(myString.lastIndexOf(".") + 1)); // Result txt