Skip to content

Instantly share code, notes, and snippets.

@indongyoo
Created April 3, 2018 12:25
Show Gist options
  • Save indongyoo/e6a2d999ee527847d7304d6c7116d4c5 to your computer and use it in GitHub Desktop.
Save indongyoo/e6a2d999ee527847d7304d6c7116d4c5 to your computer and use it in GitHub Desktop.
const team1 = {
name: 'italy',
skaters: [
{ name: 'i1', time: 3000, und: 40 },
{ name: 'i2', time: 2000, und: 30 },
{ name: 'i3', time: 1000, und: 20 }
]
};
const team2 = {
name: 'korea',
skaters: [
{ name: 'k1', time: 4000, und: 30 },
{ name: 'k2', time: 800, und: 20 },
{ name: 'k3', time: 1200, und: 20 }
]
};
function upAndDown(skater) {
return Math.floor((Math.random() * skater.und));
}
function skate(skater) {
console.log(`${skater.name} 출발`);
return new Promise(function(resolve) {
setTimeout(function() {
resolve();
}, skater.time + upAndDown(skater));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment