storySelect.js
//sorting the top-ranked genres to the least
sorting the top-ranked genres to the least
sorting the top - ranked genres to the least
function sortRanked(object){
	var sortThese = [];
	var keys = Object.keys(object);
	for(var i=0;i<keys.length;i++){
		sortThese.push([keys[i], object[keys[i]]]);
	}
	sortThese.sort(function(first, second){
								   return second[1] - first[1];
								 });
	return sortThese;
}
function sortRanked ( object ) { var sortThese = [ ] ; var keys = Object . keys ( object ) ; for ( var i = 0 ; i < keys . length ; i ++ ) { sortThese . push ( [ keys [ i ] , object [ keys [ i ] ] ] ) ; } sortThese . sort ( function ( first , second ) { return second [ 1 ] - first [ 1 ] ; } ) ; return sortThese ; }
sorting the top-ranked genres to the least
sorting the top - ranked genres to the least
//we'll put all of the key/value pairs as subarrays in a master array and then use the .sort() method to sort the master array //getting the rankedGenres keys... //and we sort em! since we want the precedence to be set on the larger of the two numbers //we'll subtract "second" from "first"