Created
April 28, 2016 08:54
-
-
Save NaitoKenzo/e52adda747d49b52c592aae890fad8b4 to your computer and use it in GitHub Desktop.
Coding Battle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Part of Q5 | |
function Component (el) { | |
this.el = el | |
this.el.addEventListener(‘click’, () => { | |
this.logClick() | |
}) | |
} | |
let total = () => { | |
square(2) * add(3, 4); | |
} | |
function functionName(tagMap) { | |
return Object.keys(tagMap).reduce(function (acc, product) { | |
return acc.concat(tagMap[product]); | |
}, []); | |
} | |
// Q2 | |
function poules(team) { | |
var answer = []; | |
for (var i = 0; i < 4; i++) { | |
var poule = []; | |
for (var j = 0; j < 5; j++) { | |
var rand = Math.floor(Math.random() * team.length); | |
poule.push(team[rand]); | |
team.splice(rand, 1); | |
} | |
answer.push(poule); | |
} | |
return answer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment