Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active April 29, 2022 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/5d414a7b9e8ed62e425843b0aafa2d41 to your computer and use it in GitHub Desktop.
Save McLarenCollege/5d414a7b9e8ed62e425843b0aafa2d41 to your computer and use it in GitHub Desktop.
organization game

Write a function getGameInfo which takes in games object, org object, and orgName string.

Examples of which are given below.

Your function should return an array containing name of the game, playersCount, releaseYear of the first game in the list for a given organization name

let games = {
    'minecraft': {
        playersCount: 10000000,
        releaseYear: 2012,
        country: ['U.S.A', 'Australia', 'France']
    },
    'temple run': {
        playersCount: 1000000,
        releaseYear: 2009,
        country: ['India', 'Pakistan', 'Kenya']
    },
    'pokemon go': {
        playersCount: 2000000,
        releaseYear: 2016,
        country: ['U.S.A', 'Canada', 'Russia']
    },
    'pubg': {
        playersCount: 5000000,
        releaseYear: 2017,
        country: ['India', 'South Africe']
    }
}
let org = { 'Microsoft': { games: ['minecraft','pokemon'] }, 'Tencent': { games: ['pubg','temple run'] }, 'Imangi': { games: [] }, 'Niantic': { games: [] } }
let orgName = 'Microsoft';

console.log(getGameInfo(games, org, orgName)); // should print ['minecraft', 10000000, 2012]. Because first game in `org` object for Microsoft is `minecraft`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment