Created
January 18, 2019 13:20
-
-
Save devmeireles/577aad7e3f417ccb34cc5fdd12a9944f 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