Skip to content

Instantly share code, notes, and snippets.

@yonisetiawan
Last active October 6, 2016 08:31
Show Gist options
  • Save yonisetiawan/e35390b68767d431dbd822526a1452b4 to your computer and use it in GitHub Desktop.
Save yonisetiawan/e35390b68767d431dbd822526a1452b4 to your computer and use it in GitHub Desktop.
function hacktiv(x){
var peserta = [];
var nama = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
for (var i = 0; i < x; i++) {
peserta.push(nama[i])
}
var hasil = [];
for (var j = 0; j < peserta.length; j++) {
for (var i = 1; i < peserta.length; i++) {
if(peserta[j]!==peserta[i]){
hasil.push([peserta[j]+", "+peserta[i]])
}
}
}
return hasil;
}
console.log(hacktiv(6))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment