Return only text after last underscore in JavaScript string
javascript
Solution
var index = str.lastIndexOf("_");
var result = str.substr(index+1);
Problem
If I have a string like so: ``` var str = 'Arthropoda_Arachnida_Zodariidae_Habronestes_hunti'; ``` How can I get just the last part of the string after the last underscore? And in the case there are no underscores just return the original string. In this case I want just `'hunti'`