I am trying to build a table of players goalscoring records. I have five arrays:
player, total_goals, goals_1st_half, goals_2nd_half and sorted_goals.
jsfiddle.net
I have created a fiddle with the base arrays in: Fiddle with arrays in and outcomes I don't wish to have the first array sorted - that should always remain as 0 for each array. A couple of players have scored the same number of goals but the player who scored the most in the first-half takes precedence - if they can't be separated it is the lowest index number.
I can sort the array Ok but cannot eliminate, push the zero and work out the arrays where the player has the same goals.
player, total_goals, goals_1st_half, goals_2nd_half and sorted_goals.
Edit fiddle - JSFiddle - Code Playground
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
I have created a fiddle with the base arrays in: Fiddle with arrays in and outcomes I don't wish to have the first array sorted - that should always remain as 0 for each array. A couple of players have scored the same number of goals but the player who scored the most in the first-half takes precedence - if they can't be separated it is the lowest index number.
I can sort the array Ok but cannot eliminate, push the zero and work out the arrays where the player has the same goals.