I am dealing with an array of clubs
var clubs =[{
team: {name: "fcb barca", rank: 4},
team: {name: "man utd", rank: 16},
team: {name: "man city", rank: 36},
team: {name: "fcb liverpool", rank: 57}
}];
The task at hand is to separate this array into two arrays, resulting in
teams["fcb barca", "man utd" , "man city", "fcb liverpool"];
rank[4,16,36,57];
I have attempted the following code but it does not seem to be functioning properly
var team = [];
var rank = [];
for(var i = 0; i < clubs.length; i++){
var tempArray1 = teams{{name: clubs[i].name, grade: clubs[i].rank}};
var tempArray2 = teams{name: clubs[i].name, grade: clubs[i].rank};
team.push( tempArray1 );
rank.push( tempArray2 );
};
console.log(team);
console.log(rank);