I am getting the list titles from my sharepoint site, I have made an app that gets "longest title name" so far, now I want to be able to get the "shortest title name" aswell, so this was my code to get the longest:
function onSuccess() {
var listString;
var listEnumerator = listCollection.getEnumerator();
var longest = "";
while (listEnumerator.moveNext()) {
var currentItem = listEnumerator.get_current(),
title = currentItem.get_title();
listString += "<br>" + title;
if (longest.length < title.length)
longest = title;
}
$('#divAllaListor').html(longest);
}
Now how do I do the same thing but getting the "shortest list title" instead of "the longest one"? :)