var $newsString = $newsLink.substr($newsLink.lastIndexOf('/')+1);
Please note that your assumption is that it is '/'present in the line and there is an identifier after it. A safer way to do this check is if it is possible that the '/'identifier may be missing or missing, it would first be checked using:
if ($newsLink.lastIndexOf('/') != -1 && $newsLink.lastIndexOf('/') + 1 < $newsLink.length) {
var $newsString = $newsLink.substr($newsLink.lastIndexOf('/')+1);
}
source
share