Code Test: You have an array of objects in JavaScript. Each one contains a name (a string) and ranking (a number). Write two functions, one to return the objects ordered by ranking and another to return the average ranking.
// Let's create some dummy data beforehand to test our work.
const data = [
{name: 'Adrian', rank: '23'},
{name: 'John', rank: 86},
{name: 'Robert', rank: '100'}
];