//module pattern
(function(window,document,undefined){
var total = 0;
var memorize = [];
var items = []
window.getItems = getItems;
function getItems(sortedArray){
if(sortedArray[0] < sortedArray[sortedArray.length -1]){
//we put the lwest priced item last becuase if we loop through that n times and the total is > desired total we are done and can shut down
sortedArray.reverse();
}
}
function testValues(){
}
}(window,window.document))
//"namespace" the data
data = {
sortedItemArray : [
{name: 'mixed fruit',cost:2.15},
{name: 'french fries',cost:2.75},
{name: 'side salad',cost:3.35},
{name: 'hot wings',cost:3.35},
{name: 'mozzarella sticks',cost:4.20},
{name: 'sampler plate',cost:5.80}
]
};
getItems(data.sortedItemArray);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.