Fork this repo with the answers and submit back!
Take the following data of student test scores:
[{
name: 'Bobby',
scores: [62,88,91,56,70]
},{
name: 'Katie',
scores: [93,70,66,85,89]
},{
name: 'Michael',
scores: [61,82,90,79,89]
},{
name: 'Sarah',
scores: [80,94,86,91,81]
}]Write a ES6 function that will take that array of student data and return the following stats:
- The students' average, min, and max scores
- The student with the highest average score
Write a single ES6 expression to take 'a=4,b=15,c=42' and convert it into an object.
Write a function serialPromise() that will execute promises in series.
Example promise function:
function delayPromise(ms) {
return new Promise(resolve => {
setTimeout(() => {
console.log('delayPromise(%d) done', ms);
resolve(2*ms);
}, ms);
});
}I should be able to run:
console.time('serialPromise')
serialPromise(delayPromise, [100,200,700,1000]).then(() => console.timeEnd('serialPromise'));Resulting in something like:
delayPromise(100) done
delayPromise(200) done
delayPromise(700) done
delayPromise(1000) done
serialPromise: 2002.3681640625ms
Have serialPromise() resolve to an array of the individual promise resolutions:
serialPromise(delayPromise, [100,500,100,600]).then(console.log);Would result in:
[200, 1000, 200, 1200]Because of the resolve(2*ms) in the delayPromise() function.