Last active
January 18, 2019 13:10
-
-
Save devmeireles/03963bbf0f89c42a2856d4692b4e8051 to your computer and use it in GitHub Desktop.
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
const http = require('http') | |
const port = 3000 | |
const ip = 'localhost' | |
var fs = require('fs') | |
var teams = 'data/static/teams.json' | |
var matches = {}; | |
const server = http.createServer((req, res) => { | |
}) | |
server.listen(port, ip, () => { | |
var teams = ['Arsenal', 'Liverpool', 'Spurs', 'Chelsea'] | |
var mergedTeams = teams.concat(teams) | |
var rounds = teams.length - 1 | |
while(rounds){ | |
for(var i=0; i<teams.length; i++) { | |
var link = i+rounds | |
var home = teams[i] | |
var away = mergedTeams[link] | |
matches[teams[i],[rounds]] = [[home],[away]] | |
//$matches[$team][$weeks] = array('home' => $home, 'away' => $away); | |
} | |
rounds-- | |
} | |
console.log(matches) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment