untitled notebook

node v4.9.1
version: master
endpointsharetweet
function setStatesOrder(stateOrderArr){ return stateOrderArr .filter(e => e.state !== "U.S.") .sort((x,y) => x.min - y.min); } stateOrderArr = [ {state: "U.S.", max: 1, min: -14, stateID: "US", final: 0.3}, {state: "Ohio", max: 5, min: -2, stateID: "OH", final: 5}, {state: "Georgia", max: 4, min: -5, stateID: "GA", final: -5}, {state: "Arizona", max: -1.5, min: -2, stateID: "AZ", final: -2}] const ordered = setStatesOrder(stateOrderArr); ordered.forEach(e => console.log(e.state));
Loading…

no comments

    sign in to comment